line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#pragma once |
2
|
|
|
|
|
|
|
#include |
3
|
|
|
|
|
|
|
#include |
4
|
|
|
|
|
|
|
#include |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
using namespace panda::time; |
7
|
|
|
|
|
|
|
using xs::Simple; |
8
|
|
|
|
|
|
|
using panda::string; |
9
|
|
|
|
|
|
|
using panda::string_view; |
10
|
|
|
|
|
|
|
|
11
|
10
|
|
|
|
|
|
static inline TimezoneSP list2vals (SV** args, I32 items, ptime_t vals[8]) { |
12
|
10
|
50
|
|
|
|
|
if (!items) return nullptr; |
13
|
|
|
|
|
|
|
|
14
|
10
|
|
|
|
|
|
TimezoneSP tz; |
15
|
10
|
100
|
|
|
|
|
if (SvPOK(args[0]) && !looks_like_number(args[0])) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
16
|
20
|
100
|
|
|
|
|
for (I32 i = 0; i < items - 1; i += 2) { |
17
|
16
|
|
|
|
|
|
SV* keysv = args[i]; |
18
|
16
|
50
|
|
|
|
|
if (!SvPOK(keysv) || SvCUR(keysv) < 2) continue; |
|
|
50
|
|
|
|
|
|
19
|
16
|
|
|
|
|
|
auto key = string_view(SvPVX(keysv), SvCUR(keysv)); |
20
|
16
|
|
|
|
|
|
switch (key[0]) { |
21
|
2
|
50
|
|
|
|
|
case 'y': if (key == "year" ) vals[0] = SvIV(args[i+1]); break; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
22
|
2
|
50
|
|
|
|
|
case 'd': if (key == "day" ) vals[2] = xs::in(args[i+1]); break; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
23
|
3
|
50
|
|
|
|
|
case 'h': if (key == "hour" ) vals[3] = xs::in(args[i+1]); break; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
24
|
4
|
50
|
|
|
|
|
case 's': if (key == "sec" ) vals[5] = xs::in(args[i+1]); break; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
case 't': if (key == "tz" ) tz = xs::in(args[i+1]); break; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
case 'i': if (key == "isdst") vals[7] = SvIV(args[i+1]); break; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
27
|
5
|
|
|
|
|
|
case 'm': switch (key[1]) { |
28
|
2
|
50
|
|
|
|
|
case 'o': if (key == "month") vals[1] = xs::in(args[i+1]); break; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
29
|
3
|
50
|
|
|
|
|
case 'i': if (key == "min" ) vals[4] = xs::in(args[i+1]); break; |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
case 'k': if (key == "mksec") vals[6] = SvIV(args[i+1]); break; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
default : warn("unknown parameter '%s'", string(key).c_str()); break; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
32
|
5
|
|
|
|
|
|
}; break; |
33
|
16
|
0
|
|
|
|
|
default: warn("unknown parameter '%s'", string(key).c_str()); break; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} else { |
37
|
6
|
50
|
|
|
|
|
if (items > 8) items = 8; |
38
|
6
|
|
|
|
|
|
switch (items) { |
39
|
0
|
0
|
|
|
|
|
case 8: tz = xs::in(args[7]); // fall through |
40
|
0
|
0
|
|
|
|
|
case 7: vals[6] = SvIV(args[6]); // fall through |
|
|
0
|
|
|
|
|
|
41
|
5
|
50
|
|
|
|
|
case 6: vals[5] = xs::in(args[5]); // fall through |
42
|
5
|
50
|
|
|
|
|
case 5: vals[4] = xs::in(args[4]); // fall through |
43
|
5
|
50
|
|
|
|
|
case 4: vals[3] = xs::in(args[3]); // fall through |
44
|
6
|
50
|
|
|
|
|
case 3: vals[2] = xs::in(args[2]); // fall through |
45
|
6
|
50
|
|
|
|
|
case 2: vals[1] = xs::in(args[1]); // fall through |
46
|
6
|
50
|
|
|
|
|
case 1: vals[0] = SvIV(args[0]); |
|
|
0
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
10
|
|
|
|
|
|
return tz; |
50
|
|
|
|
|
|
|
} |