3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
7 * Date and time functions and types.
14 /* All the headers include this file. */
17 #define __need_wchar_t
22 #endif /* Not RC_INVOKED */
25 * Number of clock ticks per second. A clock tick is the unit by which
26 * processor time is measured and is returned by 'clock'.
28 #define CLOCKS_PER_SEC ((clock_t)1000)
29 #define CLK_TCK CLOCKS_PER_SEC
35 * A type for storing the current time and date. This is the number of
36 * seconds since midnight Jan 1, 1970.
37 * NOTE: This is also defined in non-ISO sys/types.h.
39 #ifndef _TIME_T_DEFINED
41 #define _TIME_T_DEFINED
44 #ifndef __STRICT_ANSI__
45 /* A 64-bit time_t to get to Y3K */
46 #ifndef _TIME64_T_DEFINED
47 typedef __int64 __time64_t
;
48 #define _TIME64_T_DEFINED
52 * A type for measuring processor time (in clock ticks).
54 #ifndef _CLOCK_T_DEFINED
56 #define _CLOCK_T_DEFINED
61 * A structure for storing all kinds of useful information about the
62 * current (or another) time.
66 int tm_sec
; /* Seconds: 0-59 (K&R says 0-61?) */
67 int tm_min
; /* Minutes: 0-59 */
68 int tm_hour
; /* Hours since midnight: 0-23 */
69 int tm_mday
; /* Day of the month: 1-31 */
70 int tm_mon
; /* Months *since* january: 0-11 */
71 int tm_year
; /* Years since 1900 */
72 int tm_wday
; /* Days since Sunday (0-6) */
73 int tm_yday
; /* Days since Jan. 1: 0-365 */
74 int tm_isdst
; /* +1 Daylight Savings Time, 0 No DST,
84 _CRTIMP
clock_t __cdecl __MINGW_NOTHROW
clock (void);
85 _CRTIMP
time_t __cdecl __MINGW_NOTHROW
time (time_t*);
86 _CRTIMP
double __cdecl __MINGW_NOTHROW
difftime (time_t, time_t);
87 _CRTIMP
time_t __cdecl __MINGW_NOTHROW
mktime (struct tm
*);
90 * These functions write to and return pointers to static buffers that may
91 * be overwritten by other function calls. Yikes!
93 * NOTE: localtime, and perhaps the others of the four functions grouped
94 * below may return NULL if their argument is not 'acceptable'. Also note
95 * that calling asctime with a NULL pointer will produce an Invalid Page
96 * Fault and crap out your program. Guess how I know. Hint: stat called on
97 * a directory gives 'invalid' times in st_atime etc...
99 _CRTIMP
char* __cdecl __MINGW_NOTHROW
asctime (const struct tm
*);
100 _CRTIMP
char* __cdecl __MINGW_NOTHROW
ctime (const time_t*);
101 _CRTIMP
struct tm
* __cdecl __MINGW_NOTHROW
gmtime (const time_t*);
102 _CRTIMP
struct tm
* __cdecl __MINGW_NOTHROW
localtime (const time_t*);
104 _CRTIMP
size_t __cdecl __MINGW_NOTHROW
strftime (char*, size_t, const char*, const struct tm
*);
106 #ifndef __STRICT_ANSI__
108 extern _CRTIMP
void __cdecl __MINGW_NOTHROW
_tzset (void);
111 extern _CRTIMP
void __cdecl __MINGW_NOTHROW
tzset (void);
114 _CRTIMP
char* __cdecl __MINGW_NOTHROW
_strdate(char*);
115 _CRTIMP
char* __cdecl __MINGW_NOTHROW
_strtime(char*);
117 /* These require newer versions of msvcrt.dll (6.10 or higher). */
118 #if __MSVCRT_VERSION__ >= 0x0601
119 _CRTIMP __time64_t __cdecl __MINGW_NOTHROW
_time64( __time64_t
*);
120 _CRTIMP __time64_t __cdecl __MINGW_NOTHROW
_mktime64 (struct tm
*);
121 _CRTIMP
char* __cdecl __MINGW_NOTHROW
_ctime64 (const __time64_t
*);
122 _CRTIMP
struct tm
* __cdecl __MINGW_NOTHROW
_gmtime64 (const __time64_t
*);
123 _CRTIMP
struct tm
* __cdecl __MINGW_NOTHROW
_localtime64 (const __time64_t
*);
124 #endif /* __MSVCRT_VERSION__ >= 0x0601 */
127 * _daylight: non zero if daylight savings time is used.
128 * _timezone: difference in seconds between GMT and local time.
129 * _tzname: standard/daylight savings time zone names (an array with two
134 /* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */
135 extern _CRTIMP
int* __cdecl __MINGW_NOTHROW
__p__daylight (void);
136 extern _CRTIMP
long* __cdecl __MINGW_NOTHROW
__p__timezone (void);
137 extern _CRTIMP
char** __cdecl __MINGW_NOTHROW
__p__tzname (void);
139 __MINGW_IMPORT
int _daylight
;
140 __MINGW_IMPORT
long _timezone
;
141 __MINGW_IMPORT
char *_tzname
[2];
143 #else /* not __MSVCRT (ie. crtdll) */
145 #ifndef __DECLSPEC_SUPPORTED
147 extern int* _imp___daylight_dll
;
148 extern long* _imp___timezone_dll
;
149 extern char** _imp___tzname
;
151 #define _daylight (*_imp___daylight_dll)
152 #define _timezone (*_imp___timezone_dll)
153 #define _tzname (*_imp___tzname)
155 #else /* __DECLSPEC_SUPPORTED */
157 __MINGW_IMPORT
int _daylight_dll
;
158 __MINGW_IMPORT
long _timezone_dll
;
159 __MINGW_IMPORT
char* _tzname
[2];
161 #define _daylight _daylight_dll
162 #define _timezone _timezone_dll
164 #endif /* __DECLSPEC_SUPPORTED */
166 #endif /* not __MSVCRT__ */
172 /* These go in the oldnames import library for MSVCRT. */
173 __MINGW_IMPORT
int daylight
;
174 __MINGW_IMPORT
long timezone
;
175 __MINGW_IMPORT
char *tzname
[2];
177 #else /* not __MSVCRT__ */
179 /* CRTDLL is royally messed up when it comes to these macros.
180 TODO: import and alias these via oldnames import library instead
183 #define daylight _daylight
184 /* NOTE: timezone not defined as macro because it would conflict with
185 struct timezone in sys/time.h.
186 Also, tzname used to a be macro, but now it's in moldname. */
187 __MINGW_IMPORT
char *tzname
[2];
189 #endif /* not __MSVCRT__ */
191 #endif /* Not _NO_OLDNAMES */
192 #endif /* Not __STRICT_ANSI__ */
194 #ifndef _WTIME_DEFINED
195 /* wide function prototypes, also declared in wchar.h */
196 #ifndef __STRICT_ANSI__
198 _CRTIMP
wchar_t* __cdecl __MINGW_NOTHROW
_wasctime(const struct tm
*);
199 _CRTIMP
wchar_t* __cdecl __MINGW_NOTHROW
_wctime(const time_t*);
200 _CRTIMP
wchar_t* __cdecl __MINGW_NOTHROW
_wstrdate(wchar_t*);
201 _CRTIMP
wchar_t* __cdecl __MINGW_NOTHROW
_wstrtime(wchar_t*);
202 #if __MSVCRT_VERSION__ >= 0x0601
203 _CRTIMP
wchar_t* __cdecl __MINGW_NOTHROW
_wctime64 (const __time64_t
*);
205 #endif /* __MSVCRT__ */
206 #endif /* __STRICT_ANSI__ */
207 _CRTIMP
size_t __cdecl __MINGW_NOTHROW
wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm
*);
208 #define _WTIME_DEFINED
209 #endif /* _WTIME_DEFINED */
215 #endif /* Not RC_INVOKED */
217 #endif /* Not _TIME_H_ */