home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / time.h < prev    next >
C/C++ Source or Header  |  1998-06-17  |  6KB  |  236 lines

  1. /***
  2. *time.h - definitions/declarations for time routines
  3. *
  4. *       Copyright (c) 1985-1997, 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.  
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif  /* _MSC_VER > 1000 */
  19.  
  20. #ifndef _INC_TIME
  21. #define _INC_TIME
  22.  
  23. #if !defined (_WIN32) && !defined (_MAC)
  24. #error ERROR: Only Mac or Win32 targets supported!
  25. #endif  /* !defined (_WIN32) && !defined (_MAC) */
  26.  
  27. #ifndef _CRTBLD
  28. /* This version of the header files is NOT for user programs.
  29.  * It is intended for use when building the C runtimes ONLY.
  30.  * The version intended for public use will not have this message.
  31.  */
  32. #error ERROR: Use of C runtime library internal header file.
  33. #endif  /* _CRTBLD */
  34.  
  35. #ifdef _MSC_VER
  36. /*
  37.  * Currently, all MS C compilers for Win32 platforms default to 8 byte
  38.  * alignment.
  39.  */
  40. #pragma pack(push,8)
  41. #endif  /* _MSC_VER */
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif  /* __cplusplus */
  46.  
  47. #ifndef _INTERNAL_IFSTRIP_
  48. #include <cruntime.h>
  49. #endif  /* _INTERNAL_IFSTRIP_ */
  50.  
  51.  
  52. /* Define _CRTIMP */
  53.  
  54. #ifndef _CRTIMP
  55. #ifdef CRTDLL
  56. #define _CRTIMP __declspec(dllexport)
  57. #else  /* CRTDLL */
  58. #ifdef _DLL
  59. #define _CRTIMP __declspec(dllimport)
  60. #else  /* _DLL */
  61. #define _CRTIMP
  62. #endif  /* _DLL */
  63. #endif  /* CRTDLL */
  64. #endif  /* _CRTIMP */
  65.  
  66.  
  67. /* Define __cdecl for non-Microsoft compilers */
  68.  
  69. #if (!defined (_MSC_VER) && !defined (__cdecl))
  70. #define __cdecl
  71. #endif  /* (!defined (_MSC_VER) && !defined (__cdecl)) */
  72.  
  73. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  74.  
  75. #ifndef _CRTAPI1
  76. #if _MSC_VER >= 800 && _M_IX86 >= 300
  77. #define _CRTAPI1 __cdecl
  78. #else  /* _MSC_VER >= 800 && _M_IX86 >= 300 */
  79. #define _CRTAPI1
  80. #endif  /* _MSC_VER >= 800 && _M_IX86 >= 300 */
  81. #endif  /* _CRTAPI1 */
  82.  
  83. #ifndef _MAC
  84. #ifndef _WCHAR_T_DEFINED
  85. typedef unsigned short wchar_t;
  86. #define _WCHAR_T_DEFINED
  87. #endif  /* _WCHAR_T_DEFINED */
  88. #endif  /* _MAC */
  89.  
  90. /* Define the implementation defined time type */
  91.  
  92. #ifndef _TIME_T_DEFINED
  93. typedef long time_t;        /* time value */
  94. #define _TIME_T_DEFINED     /* avoid multiple def's of time_t */
  95. #endif  /* _TIME_T_DEFINED */
  96.  
  97. #ifndef _CLOCK_T_DEFINED
  98. typedef long clock_t;
  99. #define _CLOCK_T_DEFINED
  100. #endif  /* _CLOCK_T_DEFINED */
  101.  
  102. #ifndef _SIZE_T_DEFINED
  103. typedef unsigned int size_t;
  104. #define _SIZE_T_DEFINED
  105. #endif  /* _SIZE_T_DEFINED */
  106.  
  107.  
  108. /* Define NULL pointer value */
  109.  
  110. #ifndef NULL
  111. #ifdef __cplusplus
  112. #define NULL    0
  113. #else  /* __cplusplus */
  114. #define NULL    ((void *)0)
  115. #endif  /* __cplusplus */
  116. #endif  /* NULL */
  117.  
  118.  
  119. #ifndef _TM_DEFINED
  120. struct tm {
  121.         int tm_sec;     /* seconds after the minute - [0,59] */
  122.         int tm_min;     /* minutes after the hour - [0,59] */
  123.         int tm_hour;    /* hours since midnight - [0,23] */
  124.         int tm_mday;    /* day of the month - [1,31] */
  125.         int tm_mon;     /* months since January - [0,11] */
  126.         int tm_year;    /* years since 1900 */
  127.         int tm_wday;    /* days since Sunday - [0,6] */
  128.         int tm_yday;    /* days since January 1 - [0,365] */
  129.         int tm_isdst;   /* daylight savings time flag */
  130.         };
  131. #define _TM_DEFINED
  132. #endif  /* _TM_DEFINED */
  133.  
  134.  
  135. /* Clock ticks macro - ANSI version */
  136.  
  137. #define CLOCKS_PER_SEC  1000
  138.  
  139.  
  140. /* Extern declarations for the global variables used by the ctime family of
  141.  * routines.
  142.  */
  143. #ifndef _INTERNAL_IFSTRIP_
  144. #if defined (_DLL) && defined (_M_IX86)
  145. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  146. _CRTIMP int * __cdecl __p__daylight(void);
  147. _CRTIMP long * __cdecl __p__dstbias(void);
  148. _CRTIMP long * __cdecl __p__timezone(void);
  149. _CRTIMP char ** __cdecl __p__tzname(void);
  150. #endif  /* defined (_DLL) && defined (_M_IX86) */
  151. #endif  /* _INTERNAL_IFSTRIP_ */
  152.  
  153. /* non-zero if daylight savings time is used */
  154. _CRTIMP extern int _daylight;
  155.  
  156. /* offset for Daylight Saving Time */
  157. _CRTIMP extern long _dstbias;
  158.  
  159. /* difference in seconds between GMT and local time */
  160. _CRTIMP extern long _timezone;
  161.  
  162. /* standard/daylight savings time zone names */
  163. _CRTIMP extern char * _tzname[2];
  164.  
  165.  
  166. /* Function prototypes */
  167.  
  168. _CRTIMP char * __cdecl asctime(const struct tm *);
  169. _CRTIMP char * __cdecl ctime(const time_t *);
  170. _CRTIMP clock_t __cdecl clock(void);
  171. _CRTIMP double __cdecl difftime(time_t, time_t);
  172. _CRTIMP struct tm * __cdecl gmtime(const time_t *);
  173. _CRTIMP struct tm * __cdecl localtime(const time_t *);
  174. _CRTIMP time_t __cdecl mktime(struct tm *);
  175. _CRTIMP size_t __cdecl strftime(char *, size_t, const char *,
  176.         const struct tm *);
  177. _CRTIMP char * __cdecl _strdate(char *);
  178. _CRTIMP char * __cdecl _strtime(char *);
  179. _CRTIMP time_t __cdecl time(time_t *);
  180.  
  181. _CRTIMP void __cdecl _tzset(void);
  182.  
  183. /* --------- The following functions are OBSOLETE --------- */
  184. /* The Win32 API GetLocalTime and SetLocalTime should be used instead. */
  185. unsigned __cdecl _getsystime(struct tm *);
  186. unsigned __cdecl _setsystime(struct tm *, unsigned);
  187. /* --------- The preceding functions are OBSOLETE --------- */
  188.  
  189.  
  190. #ifndef _SIZE_T_DEFINED
  191. typedef unsigned int size_t;
  192. #define _SIZE_T_DEFINED
  193. #endif  /* _SIZE_T_DEFINED */
  194.  
  195. #ifndef _MAC
  196. #ifndef _WTIME_DEFINED
  197.  
  198. /* wide function prototypes, also declared in wchar.h */
  199.  
  200. _CRTIMP wchar_t * __cdecl _wasctime(const struct tm *);
  201. _CRTIMP wchar_t * __cdecl _wctime(const time_t *);
  202. _CRTIMP size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *,
  203.         const struct tm *);
  204. _CRTIMP wchar_t * __cdecl _wstrdate(wchar_t *);
  205. _CRTIMP wchar_t * __cdecl _wstrtime(wchar_t *);
  206.  
  207. #define _WTIME_DEFINED
  208. #endif  /* _WTIME_DEFINED */
  209. #endif  /* _MAC */
  210.  
  211.  
  212. #if !__STDC__
  213.  
  214. /* Non-ANSI names for compatibility */
  215.  
  216. #define CLK_TCK  CLOCKS_PER_SEC
  217.  
  218. _CRTIMP extern int daylight;
  219. _CRTIMP extern long timezone;
  220. _CRTIMP extern char * tzname[2];
  221.  
  222. _CRTIMP void __cdecl tzset(void);
  223.  
  224. #endif  /* !__STDC__ */
  225.  
  226.  
  227. #ifdef __cplusplus
  228. }
  229. #endif  /* __cplusplus */
  230.  
  231. #ifdef _MSC_VER
  232. #pragma pack(pop)
  233. #endif  /* _MSC_VER */
  234.  
  235. #endif  /* _INC_TIME */
  236.