1 /*
2  * Motif
3  *
4  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 
28 #ifdef REV_INFO
29 #ifndef lint
30 static char rcsid[] = "$XConsortium: Mrmtime.c /main/19 1996/11/21 20:03:40 drk $"
31 #endif
32 #endif
33 
34 
35 /*
36  *++
37  *  FACILITY:
38  *
39  *      UIL Resource Manager (URM):
40  *
41  *  ABSTRACT:
42  *
43  *	System-dependent routines dealing with time and dates.
44  *
45  *--
46  */
47 
48 
49 /*
50  *
51  *  INCLUDE FILES
52  *
53  */
54 
55 #define X_INCLUDE_TIME_H
56 #define XOS_USE_XT_LOCKING
57 
58 #ifndef NEED_XOS_R_H
59 #include <X11/Xos_r.h> /* Must precede Mrm/MrmAppl.h and Mrm/Mrm.h to avoid
60 			  possible redefinitions of MIN() and MAX(). */
61 #else
62  #include <Xm/Xmos_r.h>
63 #endif
64 
65 #include <Mrm/MrmAppl.h>
66 #include <Mrm/Mrm.h>
67 
68 
69 /*
70  *
71  *  TABLE OF CONTENTS
72  *
73  *	Urm__UT_Time		- Get current time as a string
74  *
75  */
76 
77 
78 /*
79  *++
80  *
81  *  PROCEDURE DESCRIPTION:
82  *
83  *	This routine writes the current date/time string into a buffer
84  *
85  *  FORMAL PARAMETERS:
86  *
87  *	time_stg	location into which to copy time string. The
88  *			length of this buffer should be at least
89  *			URMhsDate1
90  *
91  *  IMPLICIT INPUTS:
92  *
93  *  IMPLICIT OUTPUTS:
94  *
95  *  FUNCTION VALUE:
96  *
97  *  SIDE EFFECTS:
98  *
99  *--
100  */
101 
102 void
103 Urm__UT_Time (char		*time_stg)
104 {
105 #if defined(__STDC__)
106   time_t	timeval;
107 #else
108   long		timeval;
109 #endif /* __STDC__ */
110 
111   _Xctimeparams ctime_buf;
112   char *result;
113 
114   time (&timeval);
115   if ((result = _XCtime(&timeval, ctime_buf)) != NULL)
116     strcpy(time_stg, result);
117   else
118     *time_stg = 0;
119 }
120 
121