FISA C++
time64.h
1#ifndef TIME64_H
2# define TIME64_H
3
4#include <time.h>
5#include "time64_config.h"
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11/* Set our custom types */
12typedef INT_64_T Int64;
13typedef Int64 Time64_T;
14typedef Int64 Year;
15
16
17/* A copy of the tm struct but with a 64 bit year */
18struct TM64 {
19 int tm_sec;
20 int tm_min;
21 int tm_hour;
22 int tm_mday;
23 int tm_mon;
24 Year tm_year;
25 int tm_wday;
26 int tm_yday;
27 int tm_isdst;
28
29#ifdef HAS_TM_TM_GMTOFF
30 long tm_gmtoff;
31#endif
32
33#ifdef HAS_TM_TM_ZONE
34 char *tm_zone;
35#endif
36};
37
38
39/* Decide which tm struct to use */
40#ifdef USE_TM64
41#define TM TM64
42#else
43#define TM tm
44#endif
45
46
47/* Declare public functions */
48struct TM *gmtime64_r (const Time64_T *, struct TM *);
49struct TM *localtime64_r (const Time64_T *, struct TM *);
50//struct TM *gmtime64 (const Time64_T *);
51//struct TM *localtime64 (const Time64_T *);
52
53//char *asctime64 (const struct TM *);
54char *asctime64_r (const struct TM *, char *);
55
56//char *ctime64 (const Time64_T*);
57char *ctime64_r (const Time64_T*, char*);
58
59Time64_T timegm64 (const struct TM *);
60Time64_T mktime64 (struct TM *);
61Time64_T timelocal64 (struct TM *);
62
63
64/* Not everyone has gm/localtime_r(), provide a replacement */
65#ifdef HAS_LOCALTIME_R
66# define LOCALTIME_R(clock, result) localtime_r(clock, result)
67#else
68# define LOCALTIME_R(clock, result) fake_localtime_r(clock, result)
69#endif
70#ifdef HAS_GMTIME_R
71# define GMTIME_R(clock, result) gmtime_r(clock, result)
72#else
73# define GMTIME_R(clock, result) fake_gmtime_r(clock, result)
74#endif
75
76
77/* Use a different asctime format depending on how big the year is */
78#ifdef USE_TM64
79 #define TM64_ASCTIME_FORMAT "%.3s %.3s%3d %.2d:%.2d:%.2d %lld\n"
80#else
81 #define TM64_ASCTIME_FORMAT "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n"
82#endif
83
84#ifdef __cplusplus
85}
86#endif
87
88#endif
Definition: time64.h:18