line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
* This file was generated automatically by ExtUtils::ParseXS version 3.34 from the |
3
|
|
|
|
|
|
|
* contents of XS.xs. Do not edit this file, edit XS.xs instead. |
4
|
|
|
|
|
|
|
* |
5
|
|
|
|
|
|
|
* ANY CHANGES MADE HERE WILL BE LOST! |
6
|
|
|
|
|
|
|
* |
7
|
|
|
|
|
|
|
*/ |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#line 1 "XS.xs" |
10
|
|
|
|
|
|
|
#include |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
using namespace xs; |
13
|
|
|
|
|
|
|
using namespace panda::time; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
using panda::string; |
16
|
|
|
|
|
|
|
using panda::string_view; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#ifdef _WIN32 |
19
|
|
|
|
|
|
|
#define LT_FORMAT "%a %b %d %H:%M:%S %Y" |
20
|
|
|
|
|
|
|
#else |
21
|
|
|
|
|
|
|
#define LT_FORMAT "%a %b %e %H:%M:%S %Y" |
22
|
|
|
|
|
|
|
#endif |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
static inline Hash export_transition (const Timezone::Transition& trans, bool is_past) { |
25
|
|
|
|
|
|
|
auto hash = Hash::create(); |
26
|
|
|
|
|
|
|
hash.store("offset", Simple(trans.offset)); |
27
|
|
|
|
|
|
|
hash.store("abbrev", Simple(trans.abbrev)); |
28
|
|
|
|
|
|
|
if (!is_past) { |
29
|
|
|
|
|
|
|
hash.store("start", Simple(trans.start)); |
30
|
|
|
|
|
|
|
hash.store("isdst", Simple(trans.isdst)); |
31
|
|
|
|
|
|
|
hash.store("gmt_offset", Simple(trans.gmt_offset)); |
32
|
|
|
|
|
|
|
hash.store("leap_corr", Simple(trans.leap_corr)); |
33
|
|
|
|
|
|
|
hash.store("leap_delta", Simple(trans.leap_delta)); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
return hash; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#line 39 "XS.xs.cc" |
39
|
|
|
|
|
|
|
#ifndef PERL_UNUSED_VAR |
40
|
|
|
|
|
|
|
# define PERL_UNUSED_VAR(var) if (0) var = var |
41
|
|
|
|
|
|
|
#endif |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#ifndef dVAR |
44
|
|
|
|
|
|
|
# define dVAR dNOOP |
45
|
|
|
|
|
|
|
#endif |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
/* This stuff is not part of the API! You have been warned. */ |
49
|
|
|
|
|
|
|
#ifndef PERL_VERSION_DECIMAL |
50
|
|
|
|
|
|
|
# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) |
51
|
|
|
|
|
|
|
#endif |
52
|
|
|
|
|
|
|
#ifndef PERL_DECIMAL_VERSION |
53
|
|
|
|
|
|
|
# define PERL_DECIMAL_VERSION \ |
54
|
|
|
|
|
|
|
PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
55
|
|
|
|
|
|
|
#endif |
56
|
|
|
|
|
|
|
#ifndef PERL_VERSION_GE |
57
|
|
|
|
|
|
|
# define PERL_VERSION_GE(r,v,s) \ |
58
|
|
|
|
|
|
|
(PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) |
59
|
|
|
|
|
|
|
#endif |
60
|
|
|
|
|
|
|
#ifndef PERL_VERSION_LE |
61
|
|
|
|
|
|
|
# define PERL_VERSION_LE(r,v,s) \ |
62
|
|
|
|
|
|
|
(PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) |
63
|
|
|
|
|
|
|
#endif |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
/* XS_INTERNAL is the explicit static-linkage variant of the default |
66
|
|
|
|
|
|
|
* XS macro. |
67
|
|
|
|
|
|
|
* |
68
|
|
|
|
|
|
|
* XS_EXTERNAL is the same as XS_INTERNAL except it does not include |
69
|
|
|
|
|
|
|
* "STATIC", ie. it exports XSUB symbols. You probably don't want that |
70
|
|
|
|
|
|
|
* for anything but the BOOT XSUB. |
71
|
|
|
|
|
|
|
* |
72
|
|
|
|
|
|
|
* See XSUB.h in core! |
73
|
|
|
|
|
|
|
*/ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
/* TODO: This might be compatible further back than 5.10.0. */ |
77
|
|
|
|
|
|
|
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) |
78
|
|
|
|
|
|
|
# undef XS_EXTERNAL |
79
|
|
|
|
|
|
|
# undef XS_INTERNAL |
80
|
|
|
|
|
|
|
# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) |
81
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) |
82
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC XSPROTO(name) |
83
|
|
|
|
|
|
|
# endif |
84
|
|
|
|
|
|
|
# if defined(__SYMBIAN32__) |
85
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) |
86
|
|
|
|
|
|
|
# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name) |
87
|
|
|
|
|
|
|
# endif |
88
|
|
|
|
|
|
|
# ifndef XS_EXTERNAL |
89
|
|
|
|
|
|
|
# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) |
90
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) |
91
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__) |
92
|
|
|
|
|
|
|
# else |
93
|
|
|
|
|
|
|
# ifdef __cplusplus |
94
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) extern "C" XSPROTO(name) |
95
|
|
|
|
|
|
|
# define XS_INTERNAL(name) static XSPROTO(name) |
96
|
|
|
|
|
|
|
# else |
97
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) XSPROTO(name) |
98
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC XSPROTO(name) |
99
|
|
|
|
|
|
|
# endif |
100
|
|
|
|
|
|
|
# endif |
101
|
|
|
|
|
|
|
# endif |
102
|
|
|
|
|
|
|
#endif |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
/* perl >= 5.10.0 && perl <= 5.15.1 */ |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
/* The XS_EXTERNAL macro is used for functions that must not be static |
108
|
|
|
|
|
|
|
* like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL |
109
|
|
|
|
|
|
|
* macro defined, the best we can do is assume XS is the same. |
110
|
|
|
|
|
|
|
* Dito for XS_INTERNAL. |
111
|
|
|
|
|
|
|
*/ |
112
|
|
|
|
|
|
|
#ifndef XS_EXTERNAL |
113
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) XS(name) |
114
|
|
|
|
|
|
|
#endif |
115
|
|
|
|
|
|
|
#ifndef XS_INTERNAL |
116
|
|
|
|
|
|
|
# define XS_INTERNAL(name) XS(name) |
117
|
|
|
|
|
|
|
#endif |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
/* Now, finally, after all this mess, we want an ExtUtils::ParseXS |
120
|
|
|
|
|
|
|
* internal macro that we're free to redefine for varying linkage due |
121
|
|
|
|
|
|
|
* to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use |
122
|
|
|
|
|
|
|
* XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! |
123
|
|
|
|
|
|
|
*/ |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
#undef XS_EUPXS |
126
|
|
|
|
|
|
|
#if defined(PERL_EUPXS_ALWAYS_EXPORT) |
127
|
|
|
|
|
|
|
# define XS_EUPXS(name) XS_EXTERNAL(name) |
128
|
|
|
|
|
|
|
#else |
129
|
|
|
|
|
|
|
/* default to internal */ |
130
|
|
|
|
|
|
|
# define XS_EUPXS(name) XS_INTERNAL(name) |
131
|
|
|
|
|
|
|
#endif |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
134
|
|
|
|
|
|
|
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
/* prototype to pass -Wmissing-prototypes */ |
137
|
|
|
|
|
|
|
STATIC void |
138
|
|
|
|
|
|
|
S_croak_xs_usage(const CV *const cv, const char *const params); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
STATIC void |
141
|
|
|
|
|
|
|
S_croak_xs_usage(const CV *const cv, const char *const params) |
142
|
|
|
|
|
|
|
{ |
143
|
|
|
|
|
|
|
const GV *const gv = CvGV(cv); |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
PERL_ARGS_ASSERT_CROAK_XS_USAGE; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
if (gv) { |
148
|
|
|
|
|
|
|
const char *const gvname = GvNAME(gv); |
149
|
|
|
|
|
|
|
const HV *const stash = GvSTASH(gv); |
150
|
|
|
|
|
|
|
const char *const hvname = stash ? HvNAME(stash) : NULL; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
if (hvname) |
153
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); |
154
|
|
|
|
|
|
|
else |
155
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: %s(%s)", gvname, params); |
156
|
|
|
|
|
|
|
} else { |
157
|
|
|
|
|
|
|
/* Pants. I don't think that it should be possible to get here. */ |
158
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
#define croak_xs_usage S_croak_xs_usage |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
#endif |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
/* NOTE: the prototype of newXSproto() is different in versions of perls, |
168
|
|
|
|
|
|
|
* so we define a portable version of newXSproto() |
169
|
|
|
|
|
|
|
*/ |
170
|
|
|
|
|
|
|
#ifdef newXS_flags |
171
|
|
|
|
|
|
|
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) |
172
|
|
|
|
|
|
|
#else |
173
|
|
|
|
|
|
|
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) |
174
|
|
|
|
|
|
|
#endif /* !defined(newXS_flags) */ |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
177
|
|
|
|
|
|
|
# define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) |
178
|
|
|
|
|
|
|
#else |
179
|
|
|
|
|
|
|
# define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) |
180
|
|
|
|
|
|
|
#endif |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
#line 183 "XS.xs.cc" |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
185
|
2512
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS_tzget) { xs::throw_guard(aTHX_ cv, [=]() |
186
|
|
|
|
|
|
|
{ |
187
|
1256
|
|
|
|
|
|
dVAR; dXSARGS; |
188
|
1256
|
50
|
|
|
|
|
if (items < 0 || items > 1) |
|
|
50
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "zonename= string_view()"); |
190
|
|
|
|
|
|
|
{ |
191
|
2512
|
|
|
|
|
|
TimezoneSP RETVAL; |
192
|
1256
|
|
|
|
|
|
string_view zonename; |
193
|
|
|
|
|
|
|
|
194
|
1256
|
100
|
|
|
|
|
if (items < 1) |
195
|
1
|
|
|
|
|
|
zonename = string_view(); |
196
|
|
|
|
|
|
|
else { |
197
|
|
|
|
|
|
|
{ STRLEN __zonename_len; |
198
|
1255
|
50
|
|
|
|
|
const char* __zonename_buf = SvPV(ST(0), __zonename_len); |
|
|
0
|
|
|
|
|
|
199
|
1255
|
|
|
|
|
|
zonename = decltype(zonename)(__zonename_buf, __zonename_len); } |
200
|
|
|
|
|
|
|
; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
#line 33 "XS.xs" |
203
|
|
|
|
|
|
|
xs::Sv PROTO; PERL_UNUSED_VAR(PROTO); |
204
|
|
|
|
|
|
|
RETVAL = tzget(zonename); |
205
|
|
|
|
|
|
|
#line 206 "XS.xs.cc" |
206
|
|
|
|
|
|
|
{ |
207
|
|
|
|
|
|
|
SV * RETVALSV; |
208
|
1256
|
50
|
|
|
|
|
RETVALSV = xs::out(aTHX_ RETVAL, PROTO).detach(); |
209
|
1256
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
210
|
1256
|
|
|
|
|
|
ST(0) = RETVALSV; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
} |
213
|
1256
|
|
|
|
|
|
XSRETURN(1); |
214
|
1256
|
50
|
|
|
|
|
}); } |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
|
218
|
30
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS_tzname) { xs::throw_guard(aTHX_ cv, [=]() |
219
|
|
|
|
|
|
|
{ |
220
|
15
|
|
|
|
|
|
dVAR; dXSARGS; |
221
|
15
|
50
|
|
|
|
|
if (items != 0) |
222
|
0
|
|
|
|
|
|
croak_xs_usage(cv, ""); |
223
|
|
|
|
|
|
|
{ |
224
|
30
|
|
|
|
|
|
string RETVAL; |
225
|
15
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
226
|
|
|
|
|
|
|
#line 37 "XS.xs" |
227
|
|
|
|
|
|
|
RETVAL = tzlocal()->name; |
228
|
|
|
|
|
|
|
#line 229 "XS.xs.cc" |
229
|
15
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
230
|
|
|
|
|
|
|
} |
231
|
15
|
|
|
|
|
|
XSRETURN(1); |
232
|
15
|
50
|
|
|
|
|
}); } |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
|
236
|
224
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS_tzset) { xs::throw_guard(aTHX_ cv, [=]() |
237
|
|
|
|
|
|
|
{ |
238
|
112
|
|
|
|
|
|
dVAR; dXSARGS; |
239
|
112
|
50
|
|
|
|
|
if (items < 0 || items > 1) |
|
|
50
|
|
|
|
|
|
240
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "newzone= NULL"); |
241
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
242
|
112
|
|
|
|
|
|
SP -= items; |
243
|
|
|
|
|
|
|
{ |
244
|
|
|
|
|
|
|
SV* newzone; |
245
|
|
|
|
|
|
|
|
246
|
112
|
100
|
|
|
|
|
if (items < 1) |
247
|
3
|
|
|
|
|
|
newzone = NULL; |
248
|
|
|
|
|
|
|
else { |
249
|
109
|
|
|
|
|
|
newzone = ST(0) |
250
|
109
|
|
|
|
|
|
; |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
#line 41 "XS.xs" |
253
|
|
|
|
|
|
|
if (!newzone || !SvOK(newzone)) panda::time::tzset(string_view()); |
254
|
|
|
|
|
|
|
else if (SvROK(newzone)) panda::time::tzset(xs::in(aTHX_ newzone)); |
255
|
|
|
|
|
|
|
else panda::time::tzset(xs::in(aTHX_ newzone)); |
256
|
|
|
|
|
|
|
#line 257 "XS.xs.cc" |
257
|
112
|
|
|
|
|
|
PUTBACK; |
258
|
112
|
|
|
|
|
|
return; |
259
|
|
|
|
|
|
|
} |
260
|
112
|
50
|
|
|
|
|
}); } |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
58
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS_tzdir) { xs::throw_guard(aTHX_ cv, [=]() |
265
|
|
|
|
|
|
|
{ |
266
|
29
|
|
|
|
|
|
dVAR; dXSARGS; |
267
|
29
|
50
|
|
|
|
|
if (items < 0 || items > 1) |
|
|
50
|
|
|
|
|
|
268
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "newdirSV= NULL"); |
269
|
|
|
|
|
|
|
{ |
270
|
58
|
|
|
|
|
|
string RETVAL; |
271
|
29
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
272
|
|
|
|
|
|
|
SV* newdirSV; |
273
|
|
|
|
|
|
|
|
274
|
29
|
100
|
|
|
|
|
if (items < 1) |
275
|
3
|
|
|
|
|
|
newdirSV = NULL; |
276
|
|
|
|
|
|
|
else { |
277
|
26
|
|
|
|
|
|
newdirSV = ST(0) |
278
|
26
|
|
|
|
|
|
; |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
#line 47 "XS.xs" |
281
|
|
|
|
|
|
|
if (newdirSV) { |
282
|
|
|
|
|
|
|
string newdir = xs::in(aTHX_ newdirSV); |
283
|
|
|
|
|
|
|
if (tzdir(newdir)) RETVAL = "1"; |
284
|
|
|
|
|
|
|
else XSRETURN_UNDEF; |
285
|
|
|
|
|
|
|
} else |
286
|
|
|
|
|
|
|
RETVAL = tzdir(); |
287
|
|
|
|
|
|
|
#line 288 "XS.xs.cc" |
288
|
29
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
289
|
|
|
|
|
|
|
} |
290
|
29
|
|
|
|
|
|
XSRETURN(1); |
291
|
29
|
50
|
|
|
|
|
}); } |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
|
295
|
52
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS_tzsysdir) { xs::throw_guard(aTHX_ cv, [=]() |
296
|
|
|
|
|
|
|
{ |
297
|
26
|
|
|
|
|
|
dVAR; dXSARGS; |
298
|
26
|
50
|
|
|
|
|
if (items != 0) |
299
|
0
|
|
|
|
|
|
croak_xs_usage(cv, ""); |
300
|
|
|
|
|
|
|
{ |
301
|
52
|
|
|
|
|
|
string RETVAL; |
302
|
26
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
303
|
|
|
|
|
|
|
#line 56 "XS.xs" |
304
|
|
|
|
|
|
|
RETVAL = tzsysdir(); |
305
|
|
|
|
|
|
|
#line 306 "XS.xs.cc" |
306
|
26
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
307
|
|
|
|
|
|
|
} |
308
|
26
|
|
|
|
|
|
XSRETURN(1); |
309
|
26
|
50
|
|
|
|
|
}); } |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
|
313
|
47520
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS_gmtime) { xs::throw_guard(aTHX_ cv, [=]() |
314
|
|
|
|
|
|
|
{ |
315
|
23760
|
|
|
|
|
|
dVAR; dXSARGS; |
316
|
23760
|
|
|
|
|
|
dXSI32; |
317
|
23760
|
50
|
|
|
|
|
if (items < 0 || items > 1) |
|
|
50
|
|
|
|
|
|
318
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "epochSV= NULL"); |
319
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
320
|
23760
|
|
|
|
|
|
SP -= items; |
321
|
|
|
|
|
|
|
{ |
322
|
|
|
|
|
|
|
SV* epochSV; |
323
|
|
|
|
|
|
|
|
324
|
23760
|
50
|
|
|
|
|
if (items < 1) |
325
|
0
|
|
|
|
|
|
epochSV = NULL; |
326
|
|
|
|
|
|
|
else { |
327
|
23760
|
|
|
|
|
|
epochSV = ST(0) |
328
|
23760
|
|
|
|
|
|
; |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
#line 60 "XS.xs" |
331
|
|
|
|
|
|
|
ptime_t epoch; |
332
|
|
|
|
|
|
|
if (epochSV) epoch = xs::in(aTHX_ epochSV); |
333
|
|
|
|
|
|
|
else epoch = (ptime_t) ::time(NULL); |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
datetime date; |
336
|
|
|
|
|
|
|
bool success = (ix == 0) ? gmtime(epoch, &date) : localtime(epoch, &date); |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
if (GIMME_V == G_ARRAY) { |
339
|
|
|
|
|
|
|
if (!success) XSRETURN_EMPTY; |
340
|
|
|
|
|
|
|
EXTEND(SP, 9); |
341
|
|
|
|
|
|
|
EXTEND_MORTAL(9); |
342
|
|
|
|
|
|
|
mPUSHu(date.sec); |
343
|
|
|
|
|
|
|
mPUSHu(date.min); |
344
|
|
|
|
|
|
|
mPUSHu(date.hour); |
345
|
|
|
|
|
|
|
mPUSHu(date.mday); |
346
|
|
|
|
|
|
|
mPUSHu(date.mon); |
347
|
|
|
|
|
|
|
mPUSHi(date.year); |
348
|
|
|
|
|
|
|
mPUSHu(date.wday); |
349
|
|
|
|
|
|
|
mPUSHu(date.yday); |
350
|
|
|
|
|
|
|
mPUSHu(date.isdst); |
351
|
|
|
|
|
|
|
XSRETURN(9); |
352
|
|
|
|
|
|
|
} else { |
353
|
|
|
|
|
|
|
EXTEND(SP, 1); |
354
|
|
|
|
|
|
|
if (!success) XSRETURN_UNDEF; |
355
|
|
|
|
|
|
|
SV* ret = newSV(1000); |
356
|
|
|
|
|
|
|
SvPOK_on(ret); |
357
|
|
|
|
|
|
|
char* str = SvPVX(ret); |
358
|
|
|
|
|
|
|
size_t strlen = strftime(str, 1000, LT_FORMAT, &date); |
359
|
|
|
|
|
|
|
SvCUR_set(ret, strlen); |
360
|
|
|
|
|
|
|
mPUSHs(ret); |
361
|
|
|
|
|
|
|
XSRETURN(1); |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
#line 364 "XS.xs.cc" |
364
|
|
|
|
|
|
|
PUTBACK; |
365
|
|
|
|
|
|
|
return; |
366
|
|
|
|
|
|
|
} |
367
|
23760
|
50
|
|
|
|
|
}); } |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
|
371
|
47654
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS_timegm) { xs::throw_guard(aTHX_ cv, [=]() |
372
|
|
|
|
|
|
|
{ |
373
|
23827
|
|
|
|
|
|
dVAR; dXSARGS; |
374
|
23827
|
|
|
|
|
|
dXSI32; |
375
|
23827
|
50
|
|
|
|
|
if (items < 6 || items > 7) |
|
|
50
|
|
|
|
|
|
376
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "sec, min, hour, mday, mon, year, isdst= NULL"); |
377
|
|
|
|
|
|
|
{ |
378
|
|
|
|
|
|
|
ptime_t RETVAL; |
379
|
23827
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
380
|
23827
|
|
|
|
|
|
SV* sec = ST(0) |
381
|
|
|
|
|
|
|
; |
382
|
23827
|
|
|
|
|
|
SV* min = ST(1) |
383
|
|
|
|
|
|
|
; |
384
|
23827
|
|
|
|
|
|
SV* hour = ST(2) |
385
|
|
|
|
|
|
|
; |
386
|
23827
|
|
|
|
|
|
SV* mday = ST(3) |
387
|
|
|
|
|
|
|
; |
388
|
23827
|
|
|
|
|
|
SV* mon = ST(4) |
389
|
|
|
|
|
|
|
; |
390
|
23827
|
|
|
|
|
|
SV* year = ST(5) |
391
|
|
|
|
|
|
|
; |
392
|
|
|
|
|
|
|
SV* isdst; |
393
|
|
|
|
|
|
|
|
394
|
23827
|
100
|
|
|
|
|
if (items < 7) |
395
|
34
|
|
|
|
|
|
isdst = NULL; |
396
|
|
|
|
|
|
|
else { |
397
|
23793
|
|
|
|
|
|
isdst = ST(6) |
398
|
23793
|
|
|
|
|
|
; |
399
|
|
|
|
|
|
|
} |
400
|
|
|
|
|
|
|
#line 95 "XS.xs" |
401
|
|
|
|
|
|
|
datetime date; |
402
|
|
|
|
|
|
|
date.sec = xs::in(aTHX_ sec); |
403
|
|
|
|
|
|
|
date.min = xs::in(aTHX_ min); |
404
|
|
|
|
|
|
|
date.hour = xs::in(aTHX_ hour); |
405
|
|
|
|
|
|
|
date.mday = xs::in(aTHX_ mday); |
406
|
|
|
|
|
|
|
date.mon = xs::in(aTHX_ mon); |
407
|
|
|
|
|
|
|
date.year = xs::in(aTHX_ year); |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
if (isdst) date.isdst = SvIV(isdst); |
410
|
|
|
|
|
|
|
else date.isdst = -1; |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
switch (ix) { |
413
|
|
|
|
|
|
|
case 0: |
414
|
|
|
|
|
|
|
RETVAL = timegml(&date); |
415
|
|
|
|
|
|
|
break; |
416
|
|
|
|
|
|
|
case 1: |
417
|
|
|
|
|
|
|
RETVAL = timelocall(&date); |
418
|
|
|
|
|
|
|
break; |
419
|
|
|
|
|
|
|
case 2: |
420
|
|
|
|
|
|
|
RETVAL = timegm(&date); |
421
|
|
|
|
|
|
|
break; |
422
|
|
|
|
|
|
|
case 3: |
423
|
|
|
|
|
|
|
RETVAL = timelocal(&date); |
424
|
|
|
|
|
|
|
break; |
425
|
|
|
|
|
|
|
default: croak("not reached"); |
426
|
|
|
|
|
|
|
} |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
if (ix & 2) { |
429
|
|
|
|
|
|
|
sv_setiv(sec, date.sec); |
430
|
|
|
|
|
|
|
sv_setiv(min, date.min); |
431
|
|
|
|
|
|
|
sv_setiv(hour, date.hour); |
432
|
|
|
|
|
|
|
sv_setiv(mday, date.mday); |
433
|
|
|
|
|
|
|
sv_setiv(mon, date.mon); |
434
|
|
|
|
|
|
|
sv_setiv(year, date.year); |
435
|
|
|
|
|
|
|
if (isdst) sv_setiv(isdst, date.isdst); |
436
|
|
|
|
|
|
|
} |
437
|
|
|
|
|
|
|
#line 438 "XS.xs.cc" |
438
|
23826
|
100
|
|
|
|
|
XSprePUSH; PUSHi((IV)RETVAL); |
|
|
50
|
|
|
|
|
|
439
|
|
|
|
|
|
|
} |
440
|
23826
|
|
|
|
|
|
XSRETURN(1); |
441
|
23827
|
50
|
|
|
|
|
}); } |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
/* INCLUDE: Including 'Timezone.xsi' from 'XS.xs' */ |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
|
448
|
4934
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS__Timezone_name) { xs::throw_guard(aTHX_ cv, [=]() |
449
|
|
|
|
|
|
|
{ |
450
|
2467
|
|
|
|
|
|
dVAR; dXSARGS; |
451
|
2467
|
50
|
|
|
|
|
if (items != 1) |
452
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
453
|
|
|
|
|
|
|
{ |
454
|
4934
|
|
|
|
|
|
string RETVAL; |
455
|
2467
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
456
|
4934
|
50
|
|
|
|
|
TimezoneSP THIS = xs::in(aTHX_ ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
457
|
|
|
|
|
|
|
; |
458
|
|
|
|
|
|
|
#line 4 "./Timezone.xsi" |
459
|
|
|
|
|
|
|
RETVAL = THIS->name; |
460
|
|
|
|
|
|
|
#line 461 "XS.xs.cc" |
461
|
2467
|
50
|
|
|
|
|
XSprePUSH; PUSHp(RETVAL.data(), RETVAL.length()); |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
462
|
|
|
|
|
|
|
} |
463
|
2467
|
|
|
|
|
|
XSRETURN(1); |
464
|
2467
|
50
|
|
|
|
|
}); } |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
|
468
|
2458
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS__Timezone_is_local) { xs::throw_guard(aTHX_ cv, [=]() |
469
|
|
|
|
|
|
|
{ |
470
|
1229
|
|
|
|
|
|
dVAR; dXSARGS; |
471
|
1229
|
50
|
|
|
|
|
if (items != 1) |
472
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
473
|
|
|
|
|
|
|
{ |
474
|
|
|
|
|
|
|
bool RETVAL; |
475
|
2458
|
50
|
|
|
|
|
TimezoneSP THIS = xs::in(aTHX_ ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
476
|
|
|
|
|
|
|
; |
477
|
|
|
|
|
|
|
#line 6 "./Timezone.xsi" |
478
|
|
|
|
|
|
|
RETVAL = THIS->is_local; |
479
|
|
|
|
|
|
|
#line 480 "XS.xs.cc" |
480
|
1229
|
100
|
|
|
|
|
ST(0) = boolSV(RETVAL); |
481
|
|
|
|
|
|
|
} |
482
|
1229
|
|
|
|
|
|
XSRETURN(1); |
483
|
1229
|
50
|
|
|
|
|
}); } |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
|
487
|
2456
|
|
|
|
|
|
XS_EUPXS(XS_Time__XS__Timezone_export) { xs::throw_guard(aTHX_ cv, [=]() |
488
|
|
|
|
|
|
|
{ |
489
|
1228
|
|
|
|
|
|
dVAR; dXSARGS; |
490
|
1228
|
50
|
|
|
|
|
if (items != 1) |
491
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "THIS"); |
492
|
|
|
|
|
|
|
{ |
493
|
2456
|
|
|
|
|
|
Hash RETVAL; |
494
|
2456
|
50
|
|
|
|
|
TimezoneSP THIS = xs::in(aTHX_ ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
495
|
|
|
|
|
|
|
; |
496
|
|
|
|
|
|
|
#line 9 "./Timezone.xsi" |
497
|
|
|
|
|
|
|
RETVAL = Hash::create(); |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
RETVAL.store("name", Simple(string_view(THIS->name.data(), THIS->name.length()))); |
500
|
|
|
|
|
|
|
RETVAL.store("is_local", Simple(THIS->is_local ? 1 : 0)); |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
auto future = Hash::create(); |
503
|
|
|
|
|
|
|
future.store("hasdst", Simple(THIS->future.hasdst ? 1 : 0)); |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
auto outer = Hash::create(); |
506
|
|
|
|
|
|
|
outer.store("abbrev", Simple(string_view(THIS->future.outer.abbrev, strlen(THIS->future.outer.abbrev)))); |
507
|
|
|
|
|
|
|
outer.store("offset", Simple(THIS->future.outer.offset)); |
508
|
|
|
|
|
|
|
outer.store("gmt_offset", Simple(THIS->future.outer.gmt_offset)); |
509
|
|
|
|
|
|
|
outer.store("isdst", Simple(THIS->future.outer.isdst)); |
510
|
|
|
|
|
|
|
future.store("outer", Ref::create(outer)); |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
if (THIS->future.hasdst) { |
513
|
|
|
|
|
|
|
auto outer_end = Hash::create(); |
514
|
|
|
|
|
|
|
outer_end.store("mon", Simple(THIS->future.outer.end.mon)); |
515
|
|
|
|
|
|
|
outer_end.store("week", Simple(THIS->future.outer.end.yday)); |
516
|
|
|
|
|
|
|
outer_end.store("day", Simple(THIS->future.outer.end.wday)); |
517
|
|
|
|
|
|
|
outer_end.store("hour", Simple(THIS->future.outer.end.hour)); |
518
|
|
|
|
|
|
|
outer_end.store("min", Simple(THIS->future.outer.end.min)); |
519
|
|
|
|
|
|
|
outer_end.store("sec", Simple(THIS->future.outer.end.sec)); |
520
|
|
|
|
|
|
|
outer.store("end", Ref::create(outer_end)); |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
auto inner = Hash::create(); |
523
|
|
|
|
|
|
|
inner.store("abbrev", Simple(string_view(THIS->future.inner.abbrev, strlen(THIS->future.inner.abbrev)))); |
524
|
|
|
|
|
|
|
inner.store("offset", Simple(THIS->future.inner.offset)); |
525
|
|
|
|
|
|
|
inner.store("gmt_offset", Simple(THIS->future.inner.gmt_offset)); |
526
|
|
|
|
|
|
|
inner.store("isdst", Simple(THIS->future.inner.isdst)); |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
auto inner_end = Hash::create(); |
529
|
|
|
|
|
|
|
inner_end.store("mon", Simple(THIS->future.inner.end.mon)); |
530
|
|
|
|
|
|
|
inner_end.store("week", Simple(THIS->future.inner.end.yday)); |
531
|
|
|
|
|
|
|
inner_end.store("day", Simple(THIS->future.inner.end.wday)); |
532
|
|
|
|
|
|
|
inner_end.store("hour", Simple(THIS->future.inner.end.hour)); |
533
|
|
|
|
|
|
|
inner_end.store("min", Simple(THIS->future.inner.end.min)); |
534
|
|
|
|
|
|
|
inner_end.store("sec", Simple(THIS->future.inner.end.sec)); |
535
|
|
|
|
|
|
|
inner.store("end", Ref::create(inner_end)); |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
future.store("inner", Ref::create(inner)); |
538
|
|
|
|
|
|
|
} |
539
|
|
|
|
|
|
|
RETVAL.store("future", Ref::create(future)); |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
auto trans = Array::create(); |
542
|
|
|
|
|
|
|
for (uint32_t i = 0; i < THIS->trans_cnt; ++i) trans.push(Ref::create(export_transition(THIS->trans[i], false))); |
543
|
|
|
|
|
|
|
RETVAL.store("transitions", Ref::create(trans)); |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
RETVAL.store("past", Ref::create(export_transition(THIS->trans[0], true))); |
546
|
|
|
|
|
|
|
#line 547 "XS.xs.cc" |
547
|
|
|
|
|
|
|
{ |
548
|
|
|
|
|
|
|
SV * RETVALSV; |
549
|
1228
|
|
|
|
|
|
RETVALSV = NULL; |
550
|
1228
|
50
|
|
|
|
|
if (!RETVAL) XSRETURN_UNDEF; |
551
|
1228
|
50
|
|
|
|
|
RETVALSV = newRV_noinc(RETVAL.detach()); |
552
|
1228
|
50
|
|
|
|
|
RETVALSV = sv_2mortal(RETVALSV); |
553
|
1228
|
50
|
|
|
|
|
ST(0) = RETVALSV; |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
} |
556
|
1228
|
|
|
|
|
|
XSRETURN(1); |
557
|
1228
|
50
|
|
|
|
|
}); } |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
/* INCLUDE: Returning to 'XS.xs' from 'Timezone.xsi' */ |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
#ifdef __cplusplus |
563
|
|
|
|
|
|
|
extern "C" |
564
|
|
|
|
|
|
|
#endif |
565
|
|
|
|
|
|
|
|
566
|
52
|
|
|
|
|
|
XS_EXTERNAL(boot_Time__XS) { xs::throw_guard(aTHX_ cv, [=]() mutable |
567
|
|
|
|
|
|
|
{ |
568
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
569
|
|
|
|
|
|
|
dVAR; dXSARGS; |
570
|
|
|
|
|
|
|
#else |
571
|
26
|
50
|
|
|
|
|
dVAR; dXSBOOTARGSXSAPIVERCHK; |
|
|
50
|
|
|
|
|
|
572
|
|
|
|
|
|
|
#endif |
573
|
|
|
|
|
|
|
#if (PERL_REVISION == 5 && PERL_VERSION < 9) |
574
|
|
|
|
|
|
|
char* file = __FILE__; |
575
|
|
|
|
|
|
|
#else |
576
|
26
|
|
|
|
|
|
const char* file = __FILE__; |
577
|
|
|
|
|
|
|
#endif |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
PERL_UNUSED_VAR(file); |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
PERL_UNUSED_VAR(cv); /* -W */ |
582
|
|
|
|
|
|
|
PERL_UNUSED_VAR(items); /* -W */ |
583
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
584
|
|
|
|
|
|
|
XS_VERSION_BOOTCHECK; |
585
|
|
|
|
|
|
|
# ifdef XS_APIVERSION_BOOTCHECK |
586
|
|
|
|
|
|
|
XS_APIVERSION_BOOTCHECK; |
587
|
|
|
|
|
|
|
# endif |
588
|
|
|
|
|
|
|
#endif |
589
|
|
|
|
|
|
|
|
590
|
26
|
|
|
|
|
|
newXS_deffile("Time::XS::tzget", XS_Time__XS_tzget); |
591
|
26
|
|
|
|
|
|
newXS_deffile("Time::XS::tzname", XS_Time__XS_tzname); |
592
|
26
|
|
|
|
|
|
newXS_deffile("Time::XS::tzset", XS_Time__XS_tzset); |
593
|
26
|
|
|
|
|
|
newXS_deffile("Time::XS::tzdir", XS_Time__XS_tzdir); |
594
|
26
|
|
|
|
|
|
newXS_deffile("Time::XS::tzsysdir", XS_Time__XS_tzsysdir); |
595
|
26
|
|
|
|
|
|
cv = newXS_deffile("Time::XS::gmtime", XS_Time__XS_gmtime); |
596
|
26
|
|
|
|
|
|
XSANY.any_i32 = 0; |
597
|
26
|
|
|
|
|
|
cv = newXS_deffile("Time::XS::localtime", XS_Time__XS_gmtime); |
598
|
26
|
|
|
|
|
|
XSANY.any_i32 = 1; |
599
|
26
|
|
|
|
|
|
cv = newXS_deffile("Time::XS::timegm", XS_Time__XS_timegm); |
600
|
26
|
|
|
|
|
|
XSANY.any_i32 = 0; |
601
|
26
|
|
|
|
|
|
cv = newXS_deffile("Time::XS::timegmn", XS_Time__XS_timegm); |
602
|
26
|
|
|
|
|
|
XSANY.any_i32 = 2; |
603
|
26
|
|
|
|
|
|
cv = newXS_deffile("Time::XS::timelocal", XS_Time__XS_timegm); |
604
|
26
|
|
|
|
|
|
XSANY.any_i32 = 1; |
605
|
26
|
|
|
|
|
|
cv = newXS_deffile("Time::XS::timelocaln", XS_Time__XS_timegm); |
606
|
26
|
|
|
|
|
|
XSANY.any_i32 = 3; |
607
|
26
|
|
|
|
|
|
newXS_deffile("Time::XS::Timezone::name", XS_Time__XS__Timezone_name); |
608
|
26
|
|
|
|
|
|
newXS_deffile("Time::XS::Timezone::is_local", XS_Time__XS__Timezone_is_local); |
609
|
26
|
|
|
|
|
|
newXS_deffile("Time::XS::Timezone::export", XS_Time__XS__Timezone_export); |
610
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
611
|
|
|
|
|
|
|
# if PERL_VERSION_GE(5, 9, 0) |
612
|
|
|
|
|
|
|
if (PL_unitcheckav) |
613
|
|
|
|
|
|
|
call_list(PL_scopestack_ix, PL_unitcheckav); |
614
|
|
|
|
|
|
|
# endif |
615
|
|
|
|
|
|
|
XSRETURN_YES; |
616
|
|
|
|
|
|
|
#else |
617
|
26
|
|
|
|
|
|
Perl_xs_boot_epilog(aTHX_ ax); |
618
|
|
|
|
|
|
|
#endif |
619
|
26
|
50
|
|
|
|
|
}); } |
620
|
|
|
|
|
|
|
|