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.

91 lines
3.1 KiB

  1. /***
  2. *ctime.h - constant for dates and times
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Include file used by the c time routines containing definitions of
  8. * various constants and macros used in determining dates and times.
  9. *
  10. * [Internal]
  11. *
  12. *Revision History:
  13. * 03-??-84 RLB written
  14. * 05-??-84 DFW split out the constant from each routine into this file
  15. * 07-27-89 GJF Fixed copyright
  16. * 10-30-89 GJF Fixed copyright (again)
  17. * 02-28-90 GJF Added #ifndef _INC_CTIME stuff.
  18. * 03-29-93 GJF Revised constants.
  19. * 02-14-95 CFW Clean up Mac merge.
  20. * 03-29-95 CFW Add error message to internal headers.
  21. * 12-14-95 JWM Add "#pragma once".
  22. * 02-24-97 GJF Detab-ed.
  23. * 05-07-97 GJF Added _MAX_YEAR64 and _MAX_TIME64_T constants. Added
  24. * _IS_LEAP_YEAR() and _ELAPSED_LEAP_YEAR macros. Took
  25. * out unnecessary casts.
  26. * 02-09-98 GJF Changes for Win64: removed unnecessary typing of
  27. * constants as long, also put in larger value for
  28. * _MAX_YEAR.
  29. * 12-10-99 GB _MAX_YEAR for Win64 be equal to _MAX_YEAR64
  30. *
  31. ****/
  32. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  33. #pragma once
  34. #endif
  35. #ifndef _INC_CTIME
  36. #define _INC_CTIME
  37. #ifndef _CRTBLD
  38. /*
  39. * This is an internal C runtime header file. It is used when building
  40. * the C runtimes only. It is not to be used as a public header file.
  41. */
  42. #error ERROR: Use of C runtime library internal header file.
  43. #endif /* _CRTBLD */
  44. /*
  45. * Constants
  46. */
  47. #define _DAY_SEC (24 * 60 * 60) /* secs in a day */
  48. #define _YEAR_SEC (365 * _DAY_SEC) /* secs in a year */
  49. #define _FOUR_YEAR_SEC (1461 * _DAY_SEC) /* secs in a 4 year interval */
  50. #define _DEC_SEC 315532800 /* secs in 1970-1979 */
  51. #define _BASE_YEAR 70 /* 1970 is the base year */
  52. #define _BASE_DOW 4 /* 01-01-70 was a Thursday */
  53. #define _LEAP_YEAR_ADJUST 17 /* Leap years 1900 - 1970 */
  54. #ifdef _WIN64
  55. #define _MAX_YEAR 1099 /* 2999 is the max year */
  56. #else
  57. #define _MAX_YEAR 138 /* 2038 is the max year */
  58. #endif
  59. #define _MAX_YEAR64 1099 /* 2999 is the max year */
  60. #define _MAX__TIME64_T 0x100000000000i64 /* number of seconds from
  61. 00:00:00, 01/01/1970 UTC to
  62. 23:59:59. 12/31/2999 UTC */
  63. /*
  64. * Macro to determine if a given year, expressed as the number of years since
  65. * 1900, is a leap year.
  66. */
  67. #define _IS_LEAP_YEAR(y) (((y % 4 == 0) && (y % 100 != 0)) || \
  68. ((y + 1900) % 400 == 0))
  69. /*
  70. * Number of leap years from 1970 up to, but not including, the specified year
  71. * (expressed as the number of years since 1900).
  72. */
  73. #define _ELAPSED_LEAP_YEARS(y) (((y - 1)/4) - ((y - 1)/100) + ((y + 299)/400) \
  74. - _LEAP_YEAR_ADJUST)
  75. #endif /* _INC_CTIME */