Source code of Windows XP (NT5)
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.

283 lines
5.9 KiB

  1. /***
  2. *time.h - definitions/declarations for time routines
  3. *
  4. * Copyright (c) 1985-1994, 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. ****/
  13. #ifndef _INC_TIME
  14. #define _INC_TIME
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  19. #ifndef _CRTAPI1
  20. #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
  21. #define _CRTAPI1 __cdecl
  22. #else
  23. #define _CRTAPI1
  24. #endif
  25. #endif
  26. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  27. #ifndef _CRTAPI2
  28. #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
  29. #define _CRTAPI2 __cdecl
  30. #else
  31. #define _CRTAPI2
  32. #endif
  33. #endif
  34. /* Define _CRTIMP */
  35. #ifndef _CRTIMP
  36. #ifdef _NTSDK
  37. /* definition compatible with NT SDK */
  38. #define _CRTIMP
  39. #else /* ndef _NTSDK */
  40. /* current definition */
  41. #ifdef _DLL
  42. #define _CRTIMP __declspec(dllimport)
  43. #else /* ndef _DLL */
  44. #define _CRTIMP
  45. #endif /* _DLL */
  46. #endif /* _NTSDK */
  47. #endif /* _CRTIMP */
  48. /* Define __cdecl for non-Microsoft compilers */
  49. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  50. #define __cdecl
  51. #endif
  52. #ifndef _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. typedef long time_t; /* time value */
  59. #define _TIME_T_DEFINED /* avoid multiple def's of time_t */
  60. #endif
  61. #ifndef _CLOCK_T_DEFINED
  62. typedef long clock_t;
  63. #define _CLOCK_T_DEFINED
  64. #endif
  65. #ifndef _SIZE_T_DEFINED
  66. typedef unsigned int size_t;
  67. #define _SIZE_T_DEFINED
  68. #endif
  69. /* Define NULL pointer value */
  70. #ifndef NULL
  71. #ifdef __cplusplus
  72. #define NULL 0
  73. #else
  74. #define NULL ((void *)0)
  75. #endif
  76. #endif
  77. #ifndef _TM_DEFINED
  78. struct tm {
  79. int tm_sec; /* seconds after the minute - [0,59] */
  80. int tm_min; /* minutes after the hour - [0,59] */
  81. int tm_hour; /* hours since midnight - [0,23] */
  82. int tm_mday; /* day of the month - [1,31] */
  83. int tm_mon; /* months since January - [0,11] */
  84. int tm_year; /* years since 1900 */
  85. int tm_wday; /* days since Sunday - [0,6] */
  86. int tm_yday; /* days since January 1 - [0,365] */
  87. int tm_isdst; /* daylight savings time flag */
  88. };
  89. #define _TM_DEFINED
  90. #endif
  91. /* Clock ticks macro - ANSI version */
  92. #define CLOCKS_PER_SEC 1000
  93. /* Extern declarations for the global variables used by the ctime family of
  94. * routines.
  95. */
  96. #ifdef _NTSDK
  97. #ifdef _DLL
  98. /* Declarations and definitions compatible with the NT SDK */
  99. #define _daylight (*_daylight_dll)
  100. #define _timezone (*_timezone_dll)
  101. /* non-zero if daylight savings time is used */
  102. extern int * _daylight_dll;
  103. /* difference in seconds between GMT and local time */
  104. extern long * _timezone_dll;
  105. /* standard/daylight savings time zone names */
  106. extern char ** _tzname;
  107. #else /* ndef _DLL */
  108. #ifdef _POSIX_
  109. extern char * _rule;
  110. #endif /* _POSIX_ */
  111. /* non-zero if daylight savings time is used */
  112. extern int _daylight;
  113. /* difference in seconds between GMT and local time */
  114. extern long _timezone;
  115. /* standard/daylight savings time zone names */
  116. #ifdef _POSIX_
  117. extern char * tzname[2];
  118. #else /* ndef _POSIX_ */
  119. extern char * _tzname[2];
  120. #endif /* _POSIX_ */
  121. #endif /* _DLL */
  122. #else /* ndef _NTSDK */
  123. /* Current declarations and definitions */
  124. #if defined(_DLL) && defined(_M_IX86)
  125. #define _daylight (*__p__daylight())
  126. _CRTIMP int * __cdecl __p__daylight(void);
  127. #define _timezone (*__p__timezone())
  128. _CRTIMP long * __cdecl __p__timezone(void);
  129. #define _tzname (__p__tzname())
  130. _CRTIMP char ** __cdecl __p__tzname(void);
  131. #else /* !(defined(_DLL) && defined(_M_IX86)) */
  132. /* non-zero if daylight savings time is used */
  133. _CRTIMP extern int _daylight;
  134. /* difference in seconds between GMT and local time */
  135. _CRTIMP extern long _timezone;
  136. /* standard/daylight savings time zone names */
  137. _CRTIMP extern char * _tzname[2];
  138. #endif /* defined(_DLL) && defined(_M_IX86) */
  139. #endif /* _NTSDK */
  140. /* Function prototypes */
  141. _CRTIMP char * __cdecl asctime(const struct tm *);
  142. _CRTIMP char * __cdecl ctime(const time_t *);
  143. _CRTIMP clock_t __cdecl clock(void);
  144. _CRTIMP double __cdecl difftime(time_t, time_t);
  145. _CRTIMP struct tm * __cdecl gmtime(const time_t *);
  146. _CRTIMP struct tm * __cdecl localtime(const time_t *);
  147. _CRTIMP time_t __cdecl mktime(struct tm *);
  148. _CRTIMP size_t __cdecl strftime(char *, size_t, const char *,
  149. const struct tm *);
  150. _CRTIMP char * __cdecl _strdate(char *);
  151. _CRTIMP char * __cdecl _strtime(char *);
  152. _CRTIMP time_t __cdecl time(time_t *);
  153. #ifdef _POSIX_
  154. _CRTIMP void __cdecl tzset(void);
  155. #else
  156. _CRTIMP void __cdecl _tzset(void);
  157. #endif
  158. /* --------- The following functions are OBSOLETE --------- */
  159. /* The Win32 API GetLocalTime and SetLocalTime should be used instead. */
  160. unsigned __cdecl _getsystime(struct tm *);
  161. unsigned __cdecl _setsystime(struct tm *, unsigned);
  162. /* --------- The preceding functions are OBSOLETE --------- */
  163. #ifndef _SIZE_T_DEFINED
  164. typedef unsigned int size_t;
  165. #define _SIZE_T_DEFINED
  166. #endif
  167. #ifndef _WTIME_DEFINED
  168. /* wide function prototypes, also declared in wchar.h */
  169. _CRTIMP wchar_t * __cdecl _wasctime(const struct tm *);
  170. _CRTIMP wchar_t * __cdecl _wctime(const time_t *);
  171. _CRTIMP size_t __cdecl wcsftime(wchar_t *, size_t, const char *,
  172. const struct tm *);
  173. _CRTIMP wchar_t * __cdecl _wstrdate(wchar_t *);
  174. _CRTIMP wchar_t * __cdecl _wstrtime(wchar_t *);
  175. #define _WTIME_DEFINED
  176. #endif
  177. #if !__STDC__ || defined(_POSIX_)
  178. /* Non-ANSI names for compatibility */
  179. #define CLK_TCK CLOCKS_PER_SEC
  180. #ifdef _NTSDK
  181. /* Declarations and definitions compatible with the NT SDK */
  182. #define daylight _daylight
  183. /* timezone cannot be #defined to _timezone because of <sys/timeb.h> */
  184. #ifndef _POSIX_
  185. #define tzname _tzname
  186. #define tzset _tzset
  187. #endif /* _POSIX_ */
  188. #else /* ndef _NTSDK */
  189. /* Current declarations */
  190. _CRTIMP extern int daylight;
  191. _CRTIMP extern long timezone;
  192. _CRTIMP extern char * tzname[2];
  193. _CRTIMP void __cdecl tzset(void);
  194. #endif /* _NTSDK */
  195. #endif /* __STDC__ */
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199. #endif /* _INC_TIME */