add better pod and headers, and clean up some whitespace issues in the previous patches
[perl.git] / time64.h
1 #include <time.h>
2 #include "time64_config.h"
3
4 #ifndef TIME64_H
5 #    define TIME64_H
6
7
8 /* Set our custom types */
9 typedef INT_64_T        Int64;
10 typedef Int64           Time64_T;
11 typedef Int64           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         char    *tm_zone;
32 #endif
33 };
34
35
36 /* Decide which tm struct to use */
37 #ifdef USE_TM64
38 #define TM      TM64
39 #else
40 #define TM      tm
41 #endif
42
43
44 /* Declare public functions */
45 struct TM *gmtime64_r    (const Time64_T *, struct TM *);
46 struct TM *localtime64_r (const Time64_T *, struct TM *);
47 Time64_T   timegm64      (struct TM *);
48
49
50 /* Not everyone has gm/localtime_r(), provide a replacement */
51 #ifdef HAS_LOCALTIME_R
52 #    define LOCALTIME_R(clock, result) localtime_r(clock, result)
53 #else
54 #    define LOCALTIME_R(clock, result) fake_localtime_r(clock, result)
55 #endif
56 #ifdef HAS_GMTIME_R
57 #    define GMTIME_R(clock, result)    gmtime_r(clock, result)
58 #else
59 #    define GMTIME_R(clock, result)    fake_gmtime_r(clock, result)
60 #endif
61
62 #endif