Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

238 lines
5.6 KiB

  1. /***
  2. *time.h - definitions/declarations for time routines
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file has declarations of time routines and defines
  8. * the structure returned by the localtime and gmtime routines and
  9. * used by asctime.
  10. * [ANSI/System V]
  11. *
  12. * [Public]
  13. *
  14. ****/
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #ifndef _INC_TIME
  19. #define _INC_TIME
  20. #if !defined(_WIN32)
  21. #error ERROR: Only Win32 target supported!
  22. #endif
  23. #ifdef _MSC_VER
  24. /*
  25. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  26. * alignment.
  27. */
  28. #pragma pack(push,8)
  29. #endif /* _MSC_VER */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #if !defined(_W64)
  34. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
  35. #define _W64 __w64
  36. #else
  37. #define _W64
  38. #endif
  39. #endif
  40. /* Define _CRTIMP */
  41. #ifndef _CRTIMP
  42. #ifdef _DLL
  43. #define _CRTIMP __declspec(dllimport)
  44. #else /* ndef _DLL */
  45. #define _CRTIMP
  46. #endif /* _DLL */
  47. #endif /* _CRTIMP */
  48. /* Define __cdecl for non-Microsoft compilers */
  49. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  50. #define __cdecl
  51. #endif
  52. #if !defined(_WCHAR_T_DEFINED) && !defined(_NATIVE_WCHAR_T_DEFINED)
  53. typedef unsigned short wchar_t;
  54. #define _WCHAR_T_DEFINED
  55. #endif
  56. /* Define the implementation defined time type */
  57. #ifndef _TIME_T_DEFINED
  58. #ifdef _WIN64
  59. typedef __int64 time_t; /* time value */
  60. #else
  61. typedef _W64 long time_t; /* time value */
  62. #endif
  63. #define _TIME_T_DEFINED /* avoid multiple def's of time_t */
  64. #endif
  65. #ifndef _TIME64_T_DEFINED
  66. #if _INTEGRAL_MAX_BITS >= 64
  67. typedef __int64 __time64_t; /* 64-bit time value */
  68. #endif
  69. #define _TIME64_T_DEFINED
  70. #endif
  71. #ifndef _CLOCK_T_DEFINED
  72. typedef long clock_t;
  73. #define _CLOCK_T_DEFINED
  74. #endif
  75. #ifndef _SIZE_T_DEFINED
  76. #ifdef _WIN64
  77. typedef unsigned __int64 size_t;
  78. #else
  79. typedef _W64 unsigned int size_t;
  80. #endif
  81. #define _SIZE_T_DEFINED
  82. #endif
  83. /* Define NULL pointer value */
  84. #ifndef NULL
  85. #ifdef __cplusplus
  86. #define NULL 0
  87. #else
  88. #define NULL ((void *)0)
  89. #endif
  90. #endif
  91. #ifndef _TM_DEFINED
  92. struct tm {
  93. int tm_sec; /* seconds after the minute - [0,59] */
  94. int tm_min; /* minutes after the hour - [0,59] */
  95. int tm_hour; /* hours since midnight - [0,23] */
  96. int tm_mday; /* day of the month - [1,31] */
  97. int tm_mon; /* months since January - [0,11] */
  98. int tm_year; /* years since 1900 */
  99. int tm_wday; /* days since Sunday - [0,6] */
  100. int tm_yday; /* days since January 1 - [0,365] */
  101. int tm_isdst; /* daylight savings time flag */
  102. };
  103. #define _TM_DEFINED
  104. #endif
  105. /* Clock ticks macro - ANSI version */
  106. #define CLOCKS_PER_SEC 1000
  107. /* Extern declarations for the global variables used by the ctime family of
  108. * routines.
  109. */
  110. /* non-zero if daylight savings time is used */
  111. _CRTIMP extern int _daylight;
  112. /* offset for Daylight Saving Time */
  113. _CRTIMP extern long _dstbias;
  114. /* difference in seconds between GMT and local time */
  115. _CRTIMP extern long _timezone;
  116. /* standard/daylight savings time zone names */
  117. _CRTIMP extern char * _tzname[2];
  118. /* Function prototypes */
  119. _CRTIMP char * __cdecl asctime(const struct tm *);
  120. _CRTIMP char * __cdecl ctime(const time_t *);
  121. _CRTIMP clock_t __cdecl clock(void);
  122. _CRTIMP double __cdecl difftime(time_t, time_t);
  123. _CRTIMP struct tm * __cdecl gmtime(const time_t *);
  124. _CRTIMP struct tm * __cdecl localtime(const time_t *);
  125. _CRTIMP time_t __cdecl mktime(struct tm *);
  126. _CRTIMP time_t __cdecl _mkgmtime(struct tm *);
  127. _CRTIMP size_t __cdecl strftime(char *, size_t, const char *,
  128. const struct tm *);
  129. _CRTIMP char * __cdecl _strdate(char *);
  130. _CRTIMP char * __cdecl _strtime(char *);
  131. _CRTIMP time_t __cdecl time(time_t *);
  132. #ifdef _POSIX_
  133. _CRTIMP void __cdecl tzset(void);
  134. #else
  135. _CRTIMP void __cdecl _tzset(void);
  136. #endif
  137. #if _INTEGRAL_MAX_BITS >= 64
  138. _CRTIMP char * __cdecl _ctime64(const __time64_t *);
  139. _CRTIMP struct tm * __cdecl _gmtime64(const __time64_t *);
  140. _CRTIMP struct tm * __cdecl _localtime64(const __time64_t *);
  141. _CRTIMP __time64_t __cdecl _mktime64(struct tm *);
  142. _CRTIMP __time64_t __cdecl _mkgmtime64(struct tm *);
  143. _CRTIMP __time64_t __cdecl _time64(__time64_t *);
  144. #endif
  145. /* --------- The following functions are OBSOLETE --------- */
  146. /* The Win32 API GetLocalTime and SetLocalTime should be used instead. */
  147. unsigned __cdecl _getsystime(struct tm *);
  148. unsigned __cdecl _setsystime(struct tm *, unsigned);
  149. /* --------- The preceding functions are OBSOLETE --------- */
  150. #ifndef _SIZE_T_DEFINED
  151. typedef unsigned int size_t;
  152. #define _SIZE_T_DEFINED
  153. #endif
  154. #ifndef _WTIME_DEFINED
  155. /* wide function prototypes, also declared in wchar.h */
  156. _CRTIMP wchar_t * __cdecl _wasctime(const struct tm *);
  157. _CRTIMP wchar_t * __cdecl _wctime(const time_t *);
  158. _CRTIMP size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *,
  159. const struct tm *);
  160. _CRTIMP wchar_t * __cdecl _wstrdate(wchar_t *);
  161. _CRTIMP wchar_t * __cdecl _wstrtime(wchar_t *);
  162. #if _INTEGRAL_MAX_BITS >= 64
  163. _CRTIMP wchar_t * __cdecl _wctime64(const __time64_t *);
  164. #endif
  165. #define _WTIME_DEFINED
  166. #endif
  167. #if !__STDC__ || defined(_POSIX_)
  168. /* Non-ANSI names for compatibility */
  169. #define CLK_TCK CLOCKS_PER_SEC
  170. _CRTIMP extern int daylight;
  171. _CRTIMP extern long timezone;
  172. _CRTIMP extern char * tzname[2];
  173. _CRTIMP void __cdecl tzset(void);
  174. #endif /* __STDC__ */
  175. #ifdef __cplusplus
  176. }
  177. #endif
  178. #ifdef _MSC_VER
  179. #pragma pack(pop)
  180. #endif /* _MSC_VER */
  181. #endif /* _INC_TIME */