This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add global hash to handle \p{user-defined}
[perl5.git] / time64.h
1 #include <time.h>
2 #include "time64_config.h"
3
4 #ifndef PERL_TIME64_H_
5 #    define PERL_TIME64_H_
6
7
8 /* Set our custom types */
9 typedef INT_64_T        Int64;
10 typedef Int64           Time64_T;
11 typedef I32             Year;
12
13
14 /* A copy of the tm struct but with a 64 bit year */
15 struct TM64 {
16         int     tm_sec;
17         int     tm_min;
18         int     tm_hour;
19         int     tm_mday;
20         int     tm_mon;
21         Year    tm_year;
22         int     tm_wday;
23         int     tm_yday;
24         int     tm_isdst;
25
26 #ifdef HAS_TM_TM_GMTOFF
27         long    tm_gmtoff;
28 #endif
29
30 #ifdef HAS_TM_TM_ZONE
31 /* If glibc is defined or we are on QNX, use const.
32  * Otherwise, if we are on android, use const but
33  * not with g++.
34  */
35 #  if defined(__GLIBC__) || (defined(__ANDROID__) && !defined(__cplusplus)) \
36     || defined(__QNX__) || defined(__CYGWIN__)
37         const
38 #  endif
39         char    *tm_zone;
40 #endif
41 };
42
43
44 /* Decide which tm struct to use */
45 #ifdef USE_TM64
46 #define TM      TM64
47 #else
48 #define TM      tm
49 #endif
50
51
52 /* Declare functions */
53 struct TM *Perl_gmtime64_r    (const Time64_T *, struct TM *);
54 struct TM *Perl_localtime64_r (const Time64_T *, struct TM *);
55
56
57 /* Not everyone has gm/localtime_r(), provide a replacement */
58 #ifdef HAS_LOCALTIME_R
59 #    define LOCALTIME_R(clock, result) (L_R_TZSET localtime_r(clock, result))
60 #else
61 #    define LOCALTIME_R(clock, result) (L_R_TZSET S_localtime_r(clock, result))
62 #endif
63 #ifdef HAS_GMTIME_R
64 #    define GMTIME_R(clock, result)    gmtime_r(clock, result)
65 #else
66 #    define GMTIME_R(clock, result)    S_gmtime_r(clock, result)
67 #endif
68
69 #endif