This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove the AIX work around code. Instead it should just set it's LOCALTIME_MAX to...
[perl5.git] / time64.h
CommitLineData
806a119a
MS
1#include <time.h>
2
a272e669
MS
3#ifndef LOCALTIME64_H
4# define LOCALTIME64_H
5
9af24521
MS
6/* Configuration. */
7/* Define as appropriate for your system */
8/*
948ea7a9
MS
9 HAS_GMTIME_R
10 Defined if your system has gmtime_r()
11
12 HAS_LOCALTIME_R
13 Defined if your system has localtime_r()
14
9af24521
MS
15 HAS_TIMEGM
16 Defined if your system has timegm()
a272e669 17
9af24521
MS
18 HAS_TM_TM_GMTOFF
19 Defined if your tm struct has a "tm_gmtoff" element.
20
21 HAS_TM_TM_ZONE
22 Defined if your tm struct has a "tm_zone" element.
a64acb40
MS
23
24 SYSTEM_LOCALTIME_MAX
25 SYSTEM_LOCALTIME_MIN
26 SYSTEM_GMTIME_MAX
27 SYSTEM_GMTIME_MIN
28 Maximum and minimum values your system's gmtime() and localtime()
29 can handle.
30
31 USE_SYSTEM_LOCALTIME
32 USE_SYSTEM_GMTIME
33 Should we use the system functions if the time is inside their range?
806a119a
MS
34
35 USE_TM64
36 Should we use a 64 bit safe tm struct which can handle a
37 year range greater than 2 billion?
9af24521 38*/
806a119a 39
b9020a0a
MS
40#define SYSTEM_LOCALTIME_MAX LOCALTIME_MAX
41#define SYSTEM_LOCALTIME_MIN LOCALTIME_MIN
a64acb40
MS
42#define SYSTEM_GMTIME_MAX GMTIME_MAX
43#define SYSTEM_GMTIME_MIN GMTIME_MIN
44
750c447b 45/* It'll be faster */
a64acb40 46#define USE_SYSTEM_LOCALTIME 1
b9020a0a 47#define USE_SYSTEM_GMTIME 1
9af24521 48
806a119a
MS
49/* Let's get all the time */
50#define USE_TM64
51
52#ifdef USE_TM64
53#define TM TM64
54#else
55#define TM tm
56#endif
9af24521
MS
57
58/* 64 bit types. Set as appropriate for your system. */
59typedef Quad_t Time64_T;
60typedef Quad_t Int64;
750c447b 61typedef Int64 Year;
9af24521 62
806a119a
MS
63struct TM *gmtime64_r (const Time64_T *, struct TM *);
64struct TM *localtime64_r (const Time64_T *, struct TM *);
65Time64_T timegm64 (struct TM *);
66
67/* A copy of the tm struct but with a 64 bit year */
68struct TM64 {
69 int tm_sec;
70 int tm_min;
71 int tm_hour;
72 int tm_mday;
73 int tm_mon;
74 Year tm_year;
75 int tm_wday;
76 int tm_yday;
77 int tm_isdst;
78
79#ifdef HAS_TM_TM_GMTOFF
80 long tm_gmtoff;
81#endif
82
83#ifdef HAS_TM_TM_ZONE
84 char *tm_zone;
85#endif
86};
a272e669 87
948ea7a9
MS
88
89/* Not everyone has gm/localtime_r() */
90#ifdef HAS_LOCALTIME_R
91# define LOCALTIME_R(clock, result) localtime_r(clock, result)
92#else
93# define LOCALTIME_R(clock, result) fake_localtime_r(clock, result)
94#endif
95#ifdef HAS_GMTIME_R
96# define GMTIME_R(clock, result) gmtime_r(clock, result)
97#else
98# define GMTIME_R(clock, result) fake_gmtime_r(clock, result)
99#endif
100
a272e669 101#endif