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 #include <time.h>
12 
13 /* Max/min for localtime() */
14 #define SYSTEM_LOCALTIME_MAX     2147483647
15 #define SYSTEM_LOCALTIME_MIN    -2147483647-1
16 
17 /* Max/min for gmtime() */
18 #define SYSTEM_GMTIME_MAX        2147483647
19 #define SYSTEM_GMTIME_MIN       -2147483647-1
20 
21 /* Max/min for mktime() */
22 static const struct tm SYSTEM_MKTIME_MAX = {
23     7,
24     14,
25     19,
26     18,
27     0,
28     138,
29     1,
30     17,
31     0
32 #ifdef HAVE_TM_TM_GMTOFF
33     ,-28800
34 #endif
35 #ifdef HAVE_TM_TM_ZONE
36     ,(char*)"PST"
37 #endif
38 };
39 
40 static const struct tm SYSTEM_MKTIME_MIN = {
41     52,
42     45,
43     12,
44     13,
45     11,
46     1,
47     5,
48     346,
49     0
50 #ifdef HAVE_TM_TM_GMTOFF
51     ,-28800
52 #endif
53 #ifdef HAVE_TM_TM_ZONE
54     ,(char*)"PST"
55 #endif
56 };
57 
58 /* Max/min for timegm() */
59 #ifdef HAVE_TIMEGM
60 static const struct tm SYSTEM_TIMEGM_MAX = {
61     7,
62     14,
63     3,
64     19,
65     0,
66     138,
67     2,
68     18,
69     0
70     #ifdef HAVE_TM_TM_GMTOFF
71         ,0
72     #endif
73     #ifdef HAVE_TM_TM_ZONE
74         ,(char*)"UTC"
75     #endif
76 };
77 
78 static const struct tm SYSTEM_TIMEGM_MIN = {
79     52,
80     45,
81     20,
82     13,
83     11,
84     1,
85     5,
86     346,
87     0
88     #ifdef HAVE_TM_TM_GMTOFF
89         ,0
90     #endif
91     #ifdef HAVE_TM_TM_ZONE
92         ,(char*)"UTC"
93     #endif
94 };
95 #endif /* HAVE_TIMEGM */
96 
97 #endif /* TIME64_LIMITS_H */
98