This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Rename localtime64.[ch] to time64.[ch] to mirror change in y2038, and the file isn...
[perl5.git] / time64.h
CommitLineData
a272e669
MS
1#ifndef LOCALTIME64_H
2# define LOCALTIME64_H
3
9af24521
MS
4/* Configuration. */
5/* Define as appropriate for your system */
6/*
948ea7a9
MS
7 HAS_GMTIME_R
8 Defined if your system has gmtime_r()
9
10 HAS_LOCALTIME_R
11 Defined if your system has localtime_r()
12
9af24521
MS
13 HAS_TIMEGM
14 Defined if your system has timegm()
a272e669 15
9af24521
MS
16 HAS_TM_TM_GMTOFF
17 Defined if your tm struct has a "tm_gmtoff" element.
18
19 HAS_TM_TM_ZONE
20 Defined if your tm struct has a "tm_zone" element.
a64acb40
MS
21
22 SYSTEM_LOCALTIME_MAX
23 SYSTEM_LOCALTIME_MIN
24 SYSTEM_GMTIME_MAX
25 SYSTEM_GMTIME_MIN
26 Maximum and minimum values your system's gmtime() and localtime()
27 can handle.
28
29 USE_SYSTEM_LOCALTIME
30 USE_SYSTEM_GMTIME
31 Should we use the system functions if the time is inside their range?
9af24521 32*/
b9020a0a
MS
33#define SYSTEM_LOCALTIME_MAX LOCALTIME_MAX
34#define SYSTEM_LOCALTIME_MIN LOCALTIME_MIN
a64acb40
MS
35#define SYSTEM_GMTIME_MAX GMTIME_MAX
36#define SYSTEM_GMTIME_MIN GMTIME_MIN
37
750c447b 38/* It'll be faster */
a64acb40 39#define USE_SYSTEM_LOCALTIME 1
b9020a0a 40#define USE_SYSTEM_GMTIME 1
9af24521
MS
41
42
43/* 64 bit types. Set as appropriate for your system. */
44typedef Quad_t Time64_T;
45typedef Quad_t Int64;
750c447b 46typedef Int64 Year;
9af24521
MS
47
48struct tm *gmtime64_r (const Time64_T *, struct tm *);
49struct tm *localtime64_r (const Time64_T *, struct tm *);
ea722b76 50Time64_T timegm64 (struct tm *);
a272e669 51
948ea7a9
MS
52
53/* Not everyone has gm/localtime_r() */
54#ifdef HAS_LOCALTIME_R
55# define LOCALTIME_R(clock, result) localtime_r(clock, result)
56#else
57# define LOCALTIME_R(clock, result) fake_localtime_r(clock, result)
58#endif
59#ifdef HAS_GMTIME_R
60# define GMTIME_R(clock, result) gmtime_r(clock, result)
61#else
62# define GMTIME_R(clock, result) fake_gmtime_r(clock, result)
63#endif
64
a272e669 65#endif