This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop barewords from trumping subs with (*) proto
[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;
d95a2ea5 11typedef I32 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
c4065ba0
BF
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++.
48f6bf31 34 */
c4065ba0 35# if defined(__GLIBC__) || (defined(__ANDROID__) && !defined(__cplusplus)) || defined(__QNX__)
48f6bf31 36 const
b02dc803 37# endif
48f6bf31 38 char *tm_zone;
806a119a
MS
39#endif
40};
a272e669 41
948ea7a9 42
b86b480f
MS
43/* Decide which tm struct to use */
44#ifdef USE_TM64
45#define TM TM64
46#else
47#define TM tm
48#endif
49
50
7430375d
CB
51/* Declare functions */
52static struct TM *S_gmtime64_r (const Time64_T *, struct TM *);
53static struct TM *S_localtime64_r (const Time64_T *, struct TM *);
54static Time64_T S_timegm64 (struct TM *);
b86b480f
MS
55
56
57/* Not everyone has gm/localtime_r(), provide a replacement */
948ea7a9 58#ifdef HAS_LOCALTIME_R
4c6e94b1 59# define LOCALTIME_R(clock, result) (L_R_TZSET localtime_r(clock, result))
948ea7a9 60#else
7430375d 61# define LOCALTIME_R(clock, result) (L_R_TZSET S_localtime_r(clock, result))
948ea7a9
MS
62#endif
63#ifdef HAS_GMTIME_R
64# define GMTIME_R(clock, result) gmtime_r(clock, result)
65#else
7430375d 66# define GMTIME_R(clock, result) S_gmtime_r(clock, result)
948ea7a9
MS
67#endif
68
a272e669 69#endif