Added _wasctime() and _wctime().
[reactos.git] / reactos / include / msvcrt / time.h
1 /*
2 * time.h
3 *
4 * Date and time functions and types.
5 *
6 * This file is part of the Mingw32 package.
7 *
8 * Contributors:
9 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * $Revision: 1.3 $
22 * $Author: ekohl $
23 * $Date: 2001/07/06 21:16:28 $
24 *
25 */
26 /* Appropriated for Reactos Crtdll by Ariadne */
27 #ifndef _TIME_H_
28 #define _TIME_H_
29
30 #define __need_wchar_t
31 #define __need_size_t
32 #include <msvcrt/stddef.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*
39 * Number of clock ticks per second. A clock tick is the unit by which
40 * processor time is measured and is returned by 'clock'.
41 */
42 #define CLOCKS_PER_SEC 1000.0
43 #define CLK_TICK CLOCKS_PER_SEC
44
45 /*
46 * A type for measuring processor time (in clock ticks).
47 */
48 #ifndef _CLOCK_T_
49 #define _CLOCK_T_
50 typedef long clock_t;
51 #endif
52
53 /*
54 * Need a definition of time_t.
55 */
56 #include <msvcrt/sys/types.h>
57
58 /*
59 * A type for storing the current time and date. This is the number of
60 * seconds since midnight Jan 1, 1970.
61 * NOTE: Normally this is defined by the above include of sys/types.h
62 */
63 #ifndef _TIME_T_
64 #define _TIME_T_
65 typedef long time_t;
66 #endif
67
68 /*
69 * A structure for storing all kinds of useful information about the
70 * current (or another) time.
71 */
72 struct tm {
73 int tm_sec;
74 int tm_min;
75 int tm_hour;
76 int tm_mday;
77 int tm_mon;
78 int tm_year;
79 int tm_wday;
80 int tm_yday;
81 int tm_isdst;
82 char *tm_zone;
83 int tm_gmtoff;
84 };
85
86
87
88 clock_t clock (void);
89 time_t time (time_t* tp);
90 double difftime (time_t t2, time_t t1);
91 time_t mktime (struct tm* tmsp);
92
93 /*
94 * These functions write to and return pointers to static buffers that may
95 * be overwritten by other function calls. Yikes!
96 *
97 * NOTE: localtime, and perhaps the others of the four functions grouped
98 * below may return NULL if their argument is not 'acceptable'. Also note
99 * that calling asctime with a NULL pointer will produce an Invalid Page
100 * Fault and crap out your program. Guess how I know. Hint: stat called on
101 * a directory gives 'invalid' times in st_atime etc...
102 */
103 char* asctime (const struct tm* tmsp);
104 wchar_t* _wasctime(const struct tm *timeptr);
105 char* ctime (const time_t* tp);
106 wchar_t* _wctime(const time_t * const timep);
107 struct tm* gmtime (const time_t* tm);
108 struct tm* localtime (const time_t* tm);
109
110 char* _strdate(const char *datestr);
111 wchar_t* _wstrdate(const wchar_t *datestr);
112
113 size_t strftime (char* caBuffer, size_t sizeMax, const char* szFormat,
114 const struct tm* tpPrint);
115
116 size_t wcsftime (wchar_t* wcaBuffer, size_t sizeMax,
117 const wchar_t* wsFormat, const struct tm* tpPrint);
118
119 char* _strtime(char* buf);
120 wchar_t* _wstrtime(wchar_t* buf);
121
122 #ifdef __cplusplus
123 }
124 #endif
125
126 #endif