line |
true |
false |
branch |
26
|
0 |
38146 |
if (_localzone == NULL) tzset(NULL); |
31
|
1 |
1353 |
if (!zonename.length()) { |
32
|
0 |
1 |
if (!_localzone) tzset(NULL); |
|
0 |
0 |
if (!_localzone) tzset(NULL); |
35
|
1353 |
0 |
auto it = _tzcache.find(zonename); |
36
|
64 |
1289 |
if (it != _tzcache.cend()) return it->second; |
37
|
1289 |
0 |
string strname = string(zonename); |
38
|
1289 |
0 |
const Timezone* zone = _tzget(strname); |
|
1289 |
0 |
const Timezone* zone = _tzget(strname); |
39
|
1289 |
0 |
_tzcache.emplace(strname, zone); |
44
|
3 |
99 |
if (!zone) { |
46
|
1 |
2 |
if (!s) s = ""; |
48
|
2 |
1 |
if (etzname.length()) zone = tzget(etzname); |
|
2 |
0 |
if (etzname.length()) zone = tzget(etzname); |
49
|
1 |
0 |
else zone = _tzget(""); |
51
|
13 |
89 |
if (_localzone == zone) return; |
52
|
72 |
17 |
if (_localzone) { |
62
|
99 |
3 |
if (zonename.length()) tzset(tzget(zonename)); |
66
|
1292 |
0 |
const string& tzdir () { return _tzdir ? _tzdir : tzsysdir(); } |
77
|
1290 |
0 |
Timezone* zone = new Timezone(); |
80
|
1 |
1289 |
if (!zonename.length()) { |
81
|
1 |
0 |
zonename = tz_lzname(); |
|
1 |
0 |
zonename = tz_lzname(); |
83
|
0 |
1 |
assert(zonename.length()); |
86
|
0 |
1290 |
if (zonename.length() > TZNAME_MAX) { |
88
|
0 |
0 |
_virtual_fallback(zone); |
93
|
1290 |
0 |
if (zonename.front() == ':') { |
|
1 |
1289 |
if (zonename.front() == ':') { |
94
|
1 |
0 |
filename = zonename.substr(1); |
|
1 |
0 |
filename = zonename.substr(1); |
95
|
1 |
0 |
zone->name = zonename; |
98
|
1289 |
0 |
string dir = tzdir(); |
|
1289 |
0 |
string dir = tzdir(); |
99
|
0 |
1289 |
if (!dir) { |
100
|
0 |
0 |
fprintf(stderr, "ptime: tzget: this OS has no olson timezone files, you must explicitly set tzdir(DIR)\n"); |
101
|
0 |
0 |
_virtual_fallback(zone); |
104
|
1289 |
0 |
zone->name = zonename; |
105
|
1289 |
0 |
filename = dir + '/' + zonename; |
|
1289 |
0 |
filename = dir + '/' + zonename; |
|
1289 |
0 |
filename = dir + '/' + zonename; |
|
1289 |
0 |
filename = dir + '/' + zonename; |
108
|
1290 |
0 |
string content = readfile(filename); |
110
|
50 |
1240 |
if (!content) { // tz rule |
112
|
50 |
0 |
if (!_virtual_zone(zonename, zone)) { |
|
28 |
22 |
if (!_virtual_zone(zonename, zone)) { |
114
|
28 |
0 |
_virtual_fallback(zone); |
120
|
1240 |
0 |
bool result = tzparse(content, zone); |
121
|
0 |
1240 |
if (!result) { |
123
|
0 |
0 |
_virtual_fallback(zone); |
133
|
28 |
0 |
assert(_virtual_zone(GMT_FALLBACK, zone) == true); |
|
0 |
28 |
assert(_virtual_zone(GMT_FALLBACK, zone) == true); |
140
|
28 |
50 |
if (!tzparse_rule(zonename, &zone->future)) return false; |
149
|
50 |
0 |
zone->trans = new Timezone::Transition[zone->trans_cnt]; |
164
|
3 |
18 |
for (auto it = _tzcache.begin(); it != _tzcache.end(); it++) it->second->release(); |
168
|
18 |
0 |
}} |
|
18 |
0 |
}} |