This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge branch 'blead' of ssh://perl5.git.perl.org/gitroot/perl into blead
[perl5.git] / time64.h
CommitLineData
806a119a 1#include <time.h>
b86b480f 2#include "time64_config.h"
806a119a 3
b86b480f
MS
4#ifndef TIME64_H
5# define TIME64_H
a272e669 6
948ea7a9 7
b86b480f
MS
8/* Set our custom types */
9typedef INT_64_T Int64;
10typedef Int64 Time64_T;
11typedef Int64 Year;
948ea7a9 12
806a119a
MS
13
14/* A copy of the tm struct but with a 64 bit year */
15struct 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};
a272e669 34
948ea7a9 35
b86b480f
MS
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 */
45struct TM *gmtime64_r (const Time64_T *, struct TM *);
46struct TM *localtime64_r (const Time64_T *, struct TM *);
47Time64_T timegm64 (struct TM *);
48
49
50/* Not everyone has gm/localtime_r(), provide a replacement */
948ea7a9
MS
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
a272e669 62#endif