line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#undef PTIME_ANY_BORDER |
2
|
|
|
|
|
|
|
#undef PTIME_ANY_INNER |
3
|
|
|
|
|
|
|
#ifdef PTIME_AMBIGUOUS_LATER |
4
|
|
|
|
|
|
|
# define PTIME_ANY_BORDER local_lower |
5
|
|
|
|
|
|
|
# define PTIME_ANY_INNER (inner_epoch >= outborder && outer_epoch < inborder) |
6
|
|
|
|
|
|
|
#else |
7
|
|
|
|
|
|
|
# define PTIME_ANY_BORDER local_upper |
8
|
|
|
|
|
|
|
# define PTIME_ANY_INNER (min_epoch >= outborder && min_epoch < inborder) |
9
|
|
|
|
|
|
|
#endif |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#undef PTIME_ANY_NORMALIZE_LEAPSEC |
12
|
|
|
|
|
|
|
#undef PTIME_ANY_NORMALIZE_LEAPSEC_KISF |
13
|
|
|
|
|
|
|
#undef PTIME_ANY_NORMALIZE_LEAPSEC_KIST |
14
|
|
|
|
|
|
|
#ifdef PTIME_ANY_NORMALIZE |
15
|
|
|
|
|
|
|
# define PTIME_ANY_NORMALIZE_LEAPSEC(trans) \ |
16
|
|
|
|
|
|
|
_gmtime(local_epoch, date); \ |
17
|
|
|
|
|
|
|
date->n_zone = trans.n_abbrev; \ |
18
|
|
|
|
|
|
|
date->gmtoff = trans.gmt_offset; \ |
19
|
|
|
|
|
|
|
date->isdst = trans.isdst; \ |
20
|
|
|
|
|
|
|
if (keep_input_sec) date->sec = input_sec; |
21
|
|
|
|
|
|
|
# define PTIME_ANY_NORMALIZE_LEAPSEC_KISF bool keep_input_sec = false |
22
|
|
|
|
|
|
|
# define PTIME_ANY_NORMALIZE_LEAPSEC_KIST keep_input_sec = true |
23
|
|
|
|
|
|
|
#else |
24
|
|
|
|
|
|
|
# define PTIME_ANY_NORMALIZE_LEAPSEC(trans) |
25
|
|
|
|
|
|
|
# define PTIME_ANY_NORMALIZE_LEAPSEC_KISF |
26
|
|
|
|
|
|
|
# define PTIME_ANY_NORMALIZE_LEAPSEC_KIST |
27
|
|
|
|
|
|
|
#endif |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#undef PTIME_ANY_LEAPSEC_CORR |
30
|
|
|
|
|
|
|
#define PTIME_ANY_LEAPSEC_CORR(trans) \ |
31
|
|
|
|
|
|
|
if (local_epoch < trans.leap_lend) { \ |
32
|
|
|
|
|
|
|
ptime_t norm_sec = (date->sec + OUTLIM_EPOCH_BY_86400) % 60; \ |
33
|
|
|
|
|
|
|
PTIME_ANY_NORMALIZE_LEAPSEC_KISF; \ |
34
|
|
|
|
|
|
|
int32_t offset = trans.offset; \ |
35
|
|
|
|
|
|
|
if (input_sec >= 60 && input_sec < 60 + trans.leap_delta) { \ |
36
|
|
|
|
|
|
|
local_epoch -= trans.leap_delta; \ |
37
|
|
|
|
|
|
|
PTIME_ANY_NORMALIZE_LEAPSEC_KIST; \ |
38
|
|
|
|
|
|
|
} \ |
39
|
|
|
|
|
|
|
else if (norm_sec >= 60 - trans.leap_delta) offset += trans.leap_delta; \ |
40
|
|
|
|
|
|
|
PTIME_ANY_NORMALIZE_LEAPSEC(trans); \ |
41
|
|
|
|
|
|
|
return local_epoch - offset; \ |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
{ |
46
|
19099
|
|
|
|
|
|
ptime_t input_sec = date->sec; |
47
|
|
|
|
|
|
|
|
48
|
19099
|
|
|
|
|
|
ptime_t local_epoch = _timegml(date); |
49
|
|
|
|
|
|
|
|
50
|
19099
|
|
|
|
|
|
if (local_epoch < zone->ltrans.PTIME_ANY_BORDER) { |
51
|
118511
|
100
|
|
|
|
|
__PTIME_TRANS_BINFIND(local_epoch, PTIME_ANY_BORDER); |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
52
|
14580
|
100
|
|
|
|
|
PTIME_ANY_LEAPSEC_CORR(zone->trans[index]); |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#ifdef PTIME_ANY_NORMALIZE |
54
|
15
|
50
|
|
|
|
|
if (local_epoch >= zone->trans[index].local_end) { |
|
|
50
|
|
|
|
|
|
55
|
|
|
|
|
|
|
// normalize forward jump period |
56
|
4
|
|
|
|
|
|
_gmtime(local_epoch + zone->trans[index+1].delta, date); |
57
|
4
|
|
|
|
|
|
date->n_zone = zone->trans[index+1].n_abbrev; |
58
|
4
|
|
|
|
|
|
date->gmtoff = zone->trans[index+1].gmt_offset; |
59
|
4
|
|
|
|
|
|
date->isdst = zone->trans[index+1].isdst; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else { |
62
|
11
|
|
|
|
|
|
_gmtime(local_epoch, date); |
63
|
11
|
|
|
|
|
|
date->n_zone = zone->trans[index].n_abbrev; |
64
|
11
|
|
|
|
|
|
date->gmtoff = zone->trans[index].gmt_offset; |
65
|
11
|
|
|
|
|
|
date->isdst = zone->trans[index].isdst; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
#endif |
68
|
14564
|
|
|
|
|
|
return local_epoch - zone->trans[index].offset; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
4519
|
50
|
|
|
|
|
PTIME_ANY_LEAPSEC_CORR(zone->ltrans); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
4519
|
100
|
|
|
|
|
if (!zone->future.hasdst) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
74
|
|
|
|
|
|
|
#ifdef PTIME_ANY_NORMALIZE |
75
|
1
|
|
|
|
|
|
_gmtime(local_epoch, date); |
76
|
1
|
|
|
|
|
|
date->n_zone = zone->future.outer.n_abbrev; |
77
|
1
|
|
|
|
|
|
date->gmtoff = zone->future.outer.gmt_offset; |
78
|
1
|
|
|
|
|
|
date->isdst = zone->future.outer.isdst; |
79
|
|
|
|
|
|
|
#endif |
80
|
2518
|
|
|
|
|
|
return local_epoch - zone->future.outer.offset; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
2001
|
|
|
|
|
|
_gmtime(local_epoch, date); // need yday and wday |
84
|
2001
|
|
|
|
|
|
int is_leap = is_leap_year(date->year); |
85
|
2001
|
|
|
|
|
|
ptime_t outborder = _calc_rule_epoch(is_leap, date, zone->future.outer.end) - zone->future.outer.offset; |
86
|
2001
|
|
|
|
|
|
ptime_t inborder = _calc_rule_epoch(is_leap, date, zone->future.inner.end) - zone->future.inner.offset; |
87
|
|
|
|
|
|
|
#ifndef PTIME_AMBIGUOUS_LATER |
88
|
1136
|
|
|
|
|
|
ptime_t min_epoch = local_epoch - zone->future.max_offset; |
89
|
|
|
|
|
|
|
#endif |
90
|
2001
|
|
|
|
|
|
ptime_t outer_epoch = local_epoch - zone->future.outer.offset; |
91
|
2001
|
|
|
|
|
|
ptime_t inner_epoch = local_epoch - zone->future.inner.offset; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#ifndef PTIME_ANY_NORMALIZE |
94
|
1995
|
100
|
|
|
|
|
return PTIME_ANY_INNER ? inner_epoch : outer_epoch; |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#else |
96
|
6
|
50
|
|
|
|
|
if (PTIME_ANY_INNER) { |
|
|
100
|
|
|
|
|
|
97
|
2
|
0
|
|
|
|
|
if (zone->future.delta < 0 && inner_epoch >= inborder) { |
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
98
|
|
|
|
|
|
|
// normalize forward jump period for southern hemisphere |
99
|
2
|
|
|
|
|
|
_gmtime(local_epoch - zone->future.delta, date); |
100
|
2
|
|
|
|
|
|
date->n_zone = zone->future.outer.n_abbrev; |
101
|
2
|
|
|
|
|
|
date->gmtoff = zone->future.outer.gmt_offset; |
102
|
2
|
|
|
|
|
|
date->isdst = zone->future.outer.isdst; |
103
|
|
|
|
|
|
|
} else { |
104
|
0
|
|
|
|
|
|
date->n_zone = zone->future.inner.n_abbrev; |
105
|
0
|
|
|
|
|
|
date->gmtoff = zone->future.inner.gmt_offset; |
106
|
0
|
|
|
|
|
|
date->isdst = zone->future.inner.isdst; |
107
|
|
|
|
|
|
|
} |
108
|
2
|
|
|
|
|
|
return inner_epoch; |
109
|
|
|
|
|
|
|
} |
110
|
4
|
50
|
|
|
|
|
else if (zone->future.delta > 0 && inner_epoch < outborder && outer_epoch >= outborder) { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
111
|
|
|
|
|
|
|
// normalize forward jump period for northern hemisphere |
112
|
2
|
|
|
|
|
|
_gmtime(local_epoch + zone->future.delta, date); |
113
|
2
|
|
|
|
|
|
date->n_zone = zone->future.inner.n_abbrev; |
114
|
2
|
|
|
|
|
|
date->gmtoff = zone->future.inner.gmt_offset; |
115
|
2
|
|
|
|
|
|
date->isdst = zone->future.inner.isdst; |
116
|
|
|
|
|
|
|
} else { |
117
|
2
|
|
|
|
|
|
date->n_zone = zone->future.outer.n_abbrev; |
118
|
2
|
|
|
|
|
|
date->gmtoff = zone->future.outer.gmt_offset; |
119
|
2
|
|
|
|
|
|
date->isdst = zone->future.outer.isdst; |
120
|
|
|
|
|
|
|
} |
121
|
4
|
|
|
|
|
|
return outer_epoch; |
122
|
|
|
|
|
|
|
#endif |
123
|
|
|
|
|
|
|
} |