home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / time.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  5KB  |  217 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
  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
  26.  
  27.  
  28. #ifdef  _MSC_VER
  29. /*
  30.  * Currently, all MS C compilers for Win32 platforms default to 8 byte
  31.  * alignment.
  32.  */
  33. #pragma pack(push,8)
  34. #endif  /* _MSC_VER */
  35.  
  36. #ifdef  __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40.  
  41.  
  42. /* Define _CRTIMP */
  43.  
  44. #ifndef _CRTIMP
  45. #ifdef  _DLL
  46. #define _CRTIMP __declspec(dllimport)
  47. #else   /* ndef _DLL */
  48. #define _CRTIMP
  49. #endif  /* _DLL */
  50. #endif  /* _CRTIMP */
  51.  
  52.  
  53. /* Define __cdecl for non-Microsoft compilers */
  54.  
  55. #if     ( !defined(_MSC_VER) && !defined(__cdecl) )
  56. #define __cdecl
  57. #endif
  58.  
  59. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  60.  
  61. #ifndef _CRTAPI1
  62. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  63. #define _CRTAPI1 __cdecl
  64. #else
  65. #define _CRTAPI1
  66. #endif
  67. #endif
  68.  
  69. #ifndef _MAC
  70. #ifndef _WCHAR_T_DEFINED
  71. typedef unsigned short wchar_t;
  72. #define _WCHAR_T_DEFINED
  73. #endif
  74. #endif  /* ndef _MAC */
  75.  
  76. /* Define the implementation defined time type */
  77.  
  78. #ifndef _TIME_T_DEFINED
  79. typedef long time_t;        /* time value */
  80. #define _TIME_T_DEFINED     /* avoid multiple def's of time_t */
  81. #endif
  82.  
  83. #ifndef _CLOCK_T_DEFINED
  84. typedef long clock_t;
  85. #define _CLOCK_T_DEFINED
  86. #endif
  87.  
  88. #ifndef _SIZE_T_DEFINED
  89. typedef unsigned int size_t;
  90. #define _SIZE_T_DEFINED
  91. #endif
  92.  
  93.  
  94. /* Define NULL pointer value */
  95.  
  96. #ifndef NULL
  97. #ifdef __cplusplus
  98. #define NULL    0
  99. #else
  100. #define NULL    ((void *)0)
  101. #endif
  102. #endif
  103.  
  104.  
  105. #ifndef _TM_DEFINED
  106. struct tm {
  107.         int tm_sec;     /* seconds after the minute - [0,59] */
  108.         int tm_min;     /* minutes after the hour - [0,59] */
  109.         int tm_hour;    /* hours since midnight - [0,23] */
  110.         int tm_mday;    /* day of the month - [1,31] */
  111.         int tm_mon;     /* months since January - [0,11] */
  112.         int tm_year;    /* years since 1900 */
  113.         int tm_wday;    /* days since Sunday - [0,6] */
  114.         int tm_yday;    /* days since January 1 - [0,365] */
  115.         int tm_isdst;   /* daylight savings time flag */
  116.         };
  117. #define _TM_DEFINED
  118. #endif
  119.  
  120.  
  121. /* Clock ticks macro - ANSI version */
  122.  
  123. #define CLOCKS_PER_SEC  1000
  124.  
  125.  
  126. /* Extern declarations for the global variables used by the ctime family of
  127.  * routines.
  128.  */
  129.  
  130. /* non-zero if daylight savings time is used */
  131. _CRTIMP extern int _daylight;
  132.  
  133. /* offset for Daylight Saving Time */
  134. _CRTIMP extern long _dstbias;
  135.  
  136. /* difference in seconds between GMT and local time */
  137. _CRTIMP extern long _timezone;
  138.  
  139. /* standard/daylight savings time zone names */
  140. _CRTIMP extern char * _tzname[2];
  141.  
  142.  
  143. /* Function prototypes */
  144.  
  145. _CRTIMP char * __cdecl asctime(const struct tm *);
  146. _CRTIMP char * __cdecl ctime(const time_t *);
  147. _CRTIMP clock_t __cdecl clock(void);
  148. _CRTIMP double __cdecl difftime(time_t, time_t);
  149. _CRTIMP struct tm * __cdecl gmtime(const time_t *);
  150. _CRTIMP struct tm * __cdecl localtime(const time_t *);
  151. _CRTIMP time_t __cdecl mktime(struct tm *);
  152. _CRTIMP size_t __cdecl strftime(char *, size_t, const char *,
  153.         const struct tm *);
  154. _CRTIMP char * __cdecl _strdate(char *);
  155. _CRTIMP char * __cdecl _strtime(char *);
  156. _CRTIMP time_t __cdecl time(time_t *);
  157.  
  158. #ifdef  _POSIX_
  159. _CRTIMP void __cdecl tzset(void);
  160. #else
  161. _CRTIMP void __cdecl _tzset(void);
  162. #endif
  163.  
  164. /* --------- The following functions are OBSOLETE --------- */
  165. /* The Win32 API GetLocalTime and SetLocalTime should be used instead. */
  166. unsigned __cdecl _getsystime(struct tm *);
  167. unsigned __cdecl _setsystime(struct tm *, unsigned);
  168. /* --------- The preceding functions are OBSOLETE --------- */
  169.  
  170.  
  171. #ifndef _SIZE_T_DEFINED
  172. typedef unsigned int size_t;
  173. #define _SIZE_T_DEFINED
  174. #endif
  175.  
  176. #ifndef _MAC
  177. #ifndef _WTIME_DEFINED
  178.  
  179. /* wide function prototypes, also declared in wchar.h */
  180.  
  181. _CRTIMP wchar_t * __cdecl _wasctime(const struct tm *);
  182. _CRTIMP wchar_t * __cdecl _wctime(const time_t *);
  183. _CRTIMP size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *,
  184.         const struct tm *);
  185. _CRTIMP wchar_t * __cdecl _wstrdate(wchar_t *);
  186. _CRTIMP wchar_t * __cdecl _wstrtime(wchar_t *);
  187.  
  188. #define _WTIME_DEFINED
  189. #endif
  190. #endif  /* ndef _MAC */
  191.  
  192.  
  193. #if     !__STDC__ || defined(_POSIX_)
  194.  
  195. /* Non-ANSI names for compatibility */
  196.  
  197. #define CLK_TCK  CLOCKS_PER_SEC
  198.  
  199. _CRTIMP extern int daylight;
  200. _CRTIMP extern long timezone;
  201. _CRTIMP extern char * tzname[2];
  202.  
  203. _CRTIMP void __cdecl tzset(void);
  204.  
  205. #endif  /* __STDC__ */
  206.  
  207.  
  208. #ifdef  __cplusplus
  209. }
  210. #endif
  211.  
  212. #ifdef  _MSC_VER
  213. #pragma pack(pop)
  214. #endif  /* _MSC_VER */
  215.  
  216. #endif  /* _INC_TIME */
  217.