diff options
Diffstat (limited to 'src/time64_limits.h')
| -rw-r--r-- | src/time64_limits.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/time64_limits.h b/src/time64_limits.h new file mode 100644 index 0000000..91079af --- /dev/null +++ b/src/time64_limits.h | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* | ||
| 2 | Maximum and minimum inputs your system's respective time functions | ||
| 3 | can correctly handle. time64.h will use your system functions if | ||
| 4 | the input falls inside these ranges and corresponding USE_SYSTEM_* | ||
| 5 | constant is defined. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef TIME64_LIMITS_H | ||
| 9 | #define TIME64_LIMITS_H | ||
| 10 | |||
| 11 | /* Max/min for localtime() */ | ||
| 12 | #define SYSTEM_LOCALTIME_MAX 2147483647 | ||
| 13 | #define SYSTEM_LOCALTIME_MIN -2147483647-1 | ||
| 14 | |||
| 15 | /* Max/min for gmtime() */ | ||
| 16 | #define SYSTEM_GMTIME_MAX 2147483647 | ||
| 17 | #define SYSTEM_GMTIME_MIN -2147483647-1 | ||
| 18 | |||
| 19 | /* Max/min for mktime() */ | ||
| 20 | static const struct tm SYSTEM_MKTIME_MAX = { | ||
| 21 | 7, | ||
| 22 | 14, | ||
| 23 | 19, | ||
| 24 | 18, | ||
| 25 | 0, | ||
| 26 | 138, | ||
| 27 | 1, | ||
| 28 | 17, | ||
| 29 | 0 | ||
| 30 | #ifdef HAVE_TM_TM_GMTOFF | ||
| 31 | ,-28800 | ||
| 32 | #endif | ||
| 33 | #ifdef HAVE_TM_TM_ZONE | ||
| 34 | ,(char*)"PST" | ||
| 35 | #endif | ||
| 36 | }; | ||
| 37 | |||
| 38 | static const struct tm SYSTEM_MKTIME_MIN = { | ||
| 39 | 52, | ||
| 40 | 45, | ||
| 41 | 12, | ||
| 42 | 13, | ||
| 43 | 11, | ||
| 44 | 1, | ||
| 45 | 5, | ||
| 46 | 346, | ||
| 47 | 0 | ||
| 48 | #ifdef HAVE_TM_TM_GMTOFF | ||
| 49 | ,-28800 | ||
| 50 | #endif | ||
| 51 | #ifdef HAVE_TM_TM_ZONE | ||
| 52 | ,(char*)"PST" | ||
| 53 | #endif | ||
| 54 | }; | ||
| 55 | |||
| 56 | /* Max/min for timegm() */ | ||
| 57 | #ifdef HAVE_TIMEGM | ||
| 58 | static const struct tm SYSTEM_TIMEGM_MAX = { | ||
| 59 | 7, | ||
| 60 | 14, | ||
| 61 | 3, | ||
| 62 | 19, | ||
| 63 | 0, | ||
| 64 | 138, | ||
| 65 | 2, | ||
| 66 | 18, | ||
| 67 | 0 | ||
| 68 | #ifdef HAVE_TM_TM_GMTOFF | ||
| 69 | ,0 | ||
| 70 | #endif | ||
| 71 | #ifdef HAVE_TM_TM_ZONE | ||
| 72 | ,(char*)"UTC" | ||
| 73 | #endif | ||
| 74 | }; | ||
| 75 | |||
| 76 | static const struct tm SYSTEM_TIMEGM_MIN = { | ||
| 77 | 52, | ||
| 78 | 45, | ||
| 79 | 20, | ||
| 80 | 13, | ||
| 81 | 11, | ||
| 82 | 1, | ||
| 83 | 5, | ||
| 84 | 346, | ||
| 85 | 0 | ||
| 86 | #ifdef HAVE_TM_TM_GMTOFF | ||
| 87 | ,0 | ||
| 88 | #endif | ||
| 89 | #ifdef HAVE_TM_TM_ZONE | ||
| 90 | ,(char*)"UTC" | ||
| 91 | #endif | ||
| 92 | }; | ||
| 93 | #endif /* HAVE_TIMEGM */ | ||
| 94 | |||
| 95 | #endif /* TIME64_LIMITS_H */ | ||
