Line data Source code
1 : /*
2 : * SPDX-License-Identifier: MPL-2.0
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 : *
8 : * Copyright 2024 MonetDB Foundation;
9 : * Copyright August 2008 - 2023 MonetDB B.V.;
10 : * Copyright 1997 - July 2008 CWI.
11 : */
12 :
13 : /* In this file we implement three new types with supporting code.
14 : * The types are:
15 : *
16 : * - daytime - representing a time-of-day between 00:00:00 (included)
17 : * and 24:00:00 (not included);
18 : * - date - representing a date between the year -4712 and 170050;
19 : * - timestamp - a combination of date and daytime, representing an
20 : * exact point in time.
21 : *
22 : * Dates, both in the date and the timestamp types, are represented in
23 : * the so-called proleptic Gregorian calendar, that is to say, the
24 : * Gregorian calendar (which is in common use today) is extended
25 : * backwards. See e.g.
26 : * <https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar>.
27 : *
28 : * Times, both in the daytime and the timestamp types, are recorded
29 : * with microsecond precision.
30 : *
31 : * Times and timestamps are all in UTC. Conversion from the system
32 : * time zone where appropriate is done automatically.
33 : */
34 :
35 : #include "monetdb_config.h"
36 : #include "mtime.h"
37 : #include "mal_client.h"
38 :
39 :
40 : #ifndef HAVE_STRPTIME
41 : extern char *strptime(const char *, const char *, struct tm *);
42 : #endif
43 :
44 : /* interfaces callable from MAL, not used from any C code */
45 :
46 : static str
47 22 : MTIMEcurrent_date(date *ret)
48 : {
49 22 : *ret = timestamp_date(timestamp_current());
50 22 : return MAL_SUCCEED;
51 : }
52 :
53 : static str
54 9 : MTIMEcurrent_time(daytime *ret)
55 : {
56 9 : *ret = timestamp_daytime(timestamp_current());
57 9 : return MAL_SUCCEED;
58 : }
59 :
60 : static str
61 66 : MTIMEcurrent_timestamp(timestamp *ret)
62 : {
63 66 : *ret = timestamp_current();
64 66 : return MAL_SUCCEED;
65 : }
66 :
67 : #define is_str_nil strNil
68 :
69 : #define MTIME_STR_BUFFER_LENGTH MAX(strlen(str_nil) + 1, 512)
70 :
71 :
72 : #define DEC_VAR_R(TYPE, ARG) TYPE *restrict ptr##ARG
73 :
74 : #define DEC_VAR(TYPE, ARG) TYPE *ptr##ARG
75 :
76 : #define DEC_ITER(TYPE, ARG)
77 :
78 : #define DEC_BUFFER(OUTTYPE, RES, MALFUNC) \
79 : OUTTYPE RES = GDKmalloc(MTIME_STR_BUFFER_LENGTH); \
80 : if (!res) { \
81 : msg = createException(MAL, "batmtime." MALFUNC, SQLSTATE(HY013) MAL_MALLOC_FAIL); \
82 : goto bailout; \
83 : }
84 :
85 : #define DEC_INT(OUTTYPE, RES, MALFUNC) OUTTYPE RES = (OUTTYPE){0}
86 :
87 : #define INIT_VAROUT(ARG) ptr##ARG = Tloc(b##ARG, 0)
88 : #define INIT_VARIN(ARG) ptr##ARG = b##ARG##i.base
89 : #define INIT_ITERIN(ARG)
90 :
91 : #define APPEND_VAR(MALFUNC) ptrn[i] = res
92 :
93 : #define GET_NEXT_VAR(ARG, OFF) ptr##ARG[OFF]
94 :
95 : #define APPEND_STR(MALFUNC) \
96 : if (tfastins_nocheckVAR(bn, i, res) != GDK_SUCCEED) { \
97 : msg = createException(SQL, "batmtime." MALFUNC, SQLSTATE(HY013) MAL_MALLOC_FAIL); \
98 : break; \
99 : }
100 :
101 : #define GET_NEXT_ITER(ARG, OFF) BUNtvar(b##ARG##i, OFF)
102 :
103 : #define DEC_NOTHING(TYPE, ARG)
104 : #define INIT_NOTHING(ARG)
105 :
106 : #define FINISH_BUFFER_SINGLE(MALFUNC) \
107 : bailout: \
108 : *ret = NULL; \
109 : if (!msg && res && !(*ret = GDKstrdup(res))) \
110 : msg = createException(MAL, "batmtime." MALFUNC, SQLSTATE(HY013) MAL_MALLOC_FAIL); \
111 : GDKfree(res)
112 :
113 : #define FINISH_INT_SINGLE(MALFUNC) *ret = res
114 :
115 : #define FINISH_BUFFER_MULTI(RES) GDKfree(RES)
116 :
117 : #define CLEAR_NOTHING(RES)
118 :
119 :
120 : #define COPYFLAGS(n) do { bn->tsorted = b1i.sorted; bn->trevsorted = b1i.revsorted; } while (0)
121 : #define SETFLAGS(n) do { bn->tsorted = bn->trevsorted = n < 2; } while (0)
122 : #define func1(NAME, MALFUNC, INTYPE, OUTTYPE, \
123 : FUNC, SETFLAGS, FUNC_CALL, \
124 : DEC_SRC, DEC_OUTPUT, \
125 : INIT_SRC, INIT_OUTPUT, GET_NEXT_SRC) \
126 : static str \
127 : NAME(OUTTYPE *ret, const INTYPE *src) \
128 : { \
129 : str msg = MAL_SUCCEED; \
130 : do { \
131 : FUNC_CALL(FUNC, (*ret), *src); \
132 : } while (0); \
133 : return msg; \
134 : } \
135 : static str \
136 : NAME##_bulk(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
137 : { \
138 : str msg = MAL_SUCCEED; \
139 : BAT *b1 = NULL, *s = NULL, *bn = NULL; \
140 : struct canditer ci = {0}; \
141 : oid off; \
142 : bool nils = false; \
143 : bat *ret = getArgReference_bat(stk, pci, 0), \
144 : *bid = getArgReference_bat(stk, pci, 1), \
145 : *sid = pci->argc == 3 ? getArgReference_bat(stk, pci, 2) : NULL; \
146 : BATiter b1i; \
147 : DEC_SRC(INTYPE, 1); \
148 : DEC_OUTPUT(OUTTYPE, n); \
149 : \
150 : (void) cntxt; \
151 : (void) mb; \
152 : if ((b1 = BATdescriptor(*bid)) == NULL) { \
153 : msg = createException(MAL, "batmtime." MALFUNC, \
154 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
155 : goto bailout; \
156 : } \
157 : b1i = bat_iterator(b1); \
158 : if (sid && !is_bat_nil(*sid) && (s = BATdescriptor(*sid)) == NULL) { \
159 : msg = createException(MAL, "batmtime." MALFUNC, \
160 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
161 : goto bailout; \
162 : } \
163 : off = b1->hseqbase; \
164 : canditer_init(&ci, b1, s); \
165 : if ((bn = COLnew(ci.hseq, TYPE_##OUTTYPE, ci.ncand, TRANSIENT)) == NULL) { \
166 : msg = createException(MAL, "batmtime." MALFUNC, \
167 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
168 : goto bailout; \
169 : } \
170 : INIT_SRC(1); \
171 : INIT_OUTPUT(n); \
172 : if (ci.tpe == cand_dense) { \
173 : for (BUN i = 0; i < ci.ncand; i++) { \
174 : oid p = (canditer_next_dense(&ci) - off); \
175 : FUNC_CALL(FUNC, ptrn[i], GET_NEXT_SRC(1, p)); \
176 : nils |= is_##OUTTYPE##_nil(ptrn[i]); \
177 : } \
178 : } else { \
179 : for (BUN i = 0; i < ci.ncand; i++) { \
180 : oid p = (canditer_next(&ci) - off); \
181 : FUNC_CALL(FUNC, ptrn[i], GET_NEXT_SRC(1, p)); \
182 : nils |= is_##OUTTYPE##_nil(ptrn[i]); \
183 : } \
184 : } \
185 : BATsetcount(bn, ci.ncand); \
186 : bn->tnonil = !nils; \
187 : bn->tnil = nils; \
188 : SETFLAGS(ci.ncand); \
189 : bn->tkey = false; \
190 : bailout: \
191 : if (b1) { \
192 : bat_iterator_end(&b1i); \
193 : BBPunfix(b1->batCacheid); \
194 : } \
195 : BBPreclaim(s); \
196 : if (bn) { \
197 : if (msg) \
198 : BBPreclaim(bn); \
199 : else { \
200 : *ret = bn->batCacheid; \
201 : BBPkeepref(bn); \
202 : } \
203 : } \
204 : return msg; \
205 : }
206 :
207 : #define func1_noexcept(FUNC, RET, PARAM) RET = FUNC(PARAM)
208 : #define func1_except(FUNC, RET, PARAM) msg = FUNC(&RET, PARAM); if (msg) break
209 :
210 : #define func2(NAME, MALFUNC, \
211 : INTYPE1, INTYPE2, OUTTYPE, FUNC, FUNC_CALL, \
212 : DEC_SRC1, DEC_SRC2, DEC_OUTPUT, DEC_EXTRA, \
213 : INIT_SRC1, INIT_SRC2, INIT_OUTPUT, \
214 : GET_NEXT_SRC1, GET_NEXT_SRC2, \
215 : APPEND_NEXT, CLEAR_EXTRA_SINGLE, CLEAR_EXTRA_MULTI) \
216 : static str \
217 : NAME(OUTTYPE *ret, const INTYPE1 *v1, const INTYPE2 *v2) \
218 : { \
219 : str msg = MAL_SUCCEED; \
220 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
221 : \
222 : do { \
223 : FUNC_CALL(FUNC, res, *v1, *v2); \
224 : } while (0); \
225 : CLEAR_EXTRA_SINGLE(MALFUNC); \
226 : return msg; \
227 : } \
228 : static str \
229 : NAME##_bulk(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
230 : { \
231 : str msg = MAL_SUCCEED; \
232 : BAT *b1 = NULL, *b2 = NULL, *s1 = NULL, *s2 = NULL, *bn = NULL; \
233 : oid off1, off2; \
234 : struct canditer ci1 = {0}, ci2 = {0}; \
235 : bool nils = false; \
236 : bat *ret = getArgReference_bat(stk, pci, 0), \
237 : *bid1 = getArgReference_bat(stk, pci, 1), \
238 : *bid2 = getArgReference_bat(stk, pci, 2), \
239 : *sid1 = pci->argc == 5 ? getArgReference_bat(stk, pci, 3) : NULL, \
240 : *sid2 = pci->argc == 5 ? getArgReference_bat(stk, pci, 4) : NULL; \
241 : BATiter b1i, b2i = (BATiter){ .vh = NULL }; \
242 : DEC_SRC1(INTYPE1, 1); \
243 : DEC_SRC2(INTYPE2, 2); \
244 : DEC_OUTPUT(OUTTYPE, n); \
245 : \
246 : (void) cntxt; \
247 : (void) mb; \
248 : b1 = BATdescriptor(*bid1); \
249 : b2 = BATdescriptor(*bid2); \
250 : b1i = bat_iterator(b1); \
251 : b2i = bat_iterator(b2); \
252 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
253 : if (b1 == NULL || b2 == NULL) { \
254 : msg = createException(MAL, "batmtime." MALFUNC, \
255 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
256 : goto bailout; \
257 : } \
258 : if (sid1 && !is_bat_nil(*sid1) && (s1 = BATdescriptor(*sid1)) == NULL) { \
259 : msg = createException(MAL, "batmtime." MALFUNC, \
260 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
261 : goto bailout; \
262 : } \
263 : if (sid2 && !is_bat_nil(*sid2) && (s2 = BATdescriptor(*sid2)) == NULL) { \
264 : msg = createException(MAL, "batmtime." MALFUNC, \
265 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
266 : goto bailout; \
267 : } \
268 : canditer_init(&ci1, b1, s1); \
269 : canditer_init(&ci2, b2, s2); \
270 : if (ci2.ncand != ci1.ncand || ci1.hseq != ci2.hseq) { \
271 : msg = createException(MAL, "batmtime." MALFUNC, \
272 : "inputs not the same size"); \
273 : goto bailout; \
274 : } \
275 : if ((bn = COLnew(ci1.hseq, TYPE_##OUTTYPE, ci1.ncand, TRANSIENT)) == NULL) { \
276 : msg = createException(MAL, "batmtime." MALFUNC, \
277 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
278 : goto bailout; \
279 : } \
280 : off1 = b1->hseqbase; \
281 : off2 = b2->hseqbase; \
282 : INIT_SRC1(1); \
283 : INIT_SRC2(2); \
284 : INIT_OUTPUT(n); \
285 : if (ci1.tpe == cand_dense && ci2.tpe == cand_dense) { \
286 : for (BUN i = 0; i < ci1.ncand; i++) { \
287 : oid p1 = (canditer_next_dense(&ci1) - off1); \
288 : oid p2 = (canditer_next_dense(&ci2) - off2); \
289 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), GET_NEXT_SRC2(2, p2)); \
290 : APPEND_NEXT(MALFUNC); \
291 : nils |= is_##OUTTYPE##_nil(res); \
292 : } \
293 : } else { \
294 : for (BUN i = 0; i < ci1.ncand; i++) { \
295 : oid p1 = (canditer_next(&ci1) - off1); \
296 : oid p2 = (canditer_next(&ci2) - off2); \
297 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), GET_NEXT_SRC2(2, p2)); \
298 : APPEND_NEXT(MALFUNC); \
299 : nils |= is_##OUTTYPE##_nil(res); \
300 : } \
301 : } \
302 : BATsetcount(bn, ci1.ncand); \
303 : bn->tnonil = !nils; \
304 : bn->tnil = nils; \
305 : bn->tsorted = ci1.ncand < 2; \
306 : bn->trevsorted = ci1.ncand < 2; \
307 : bn->tkey = false; \
308 : bailout: \
309 : CLEAR_EXTRA_MULTI(res); \
310 : bat_iterator_end(&b1i); \
311 : bat_iterator_end(&b2i); \
312 : BBPreclaim(b1); \
313 : BBPreclaim(b2); \
314 : BBPreclaim(s1); \
315 : BBPreclaim(s2); \
316 : if (bn) { \
317 : if (msg) \
318 : BBPreclaim(bn); \
319 : else { \
320 : *ret = bn->batCacheid; \
321 : BBPkeepref(bn); \
322 : } \
323 : } \
324 : return msg; \
325 : } \
326 : static str \
327 : NAME##_bulk_p1(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
328 : { \
329 : str msg = MAL_SUCCEED; \
330 : BAT *b2 = NULL, *s2 = NULL, *bn = NULL; \
331 : oid off2; \
332 : struct canditer ci2 = {0}; \
333 : bool nils = false; \
334 : bat *ret = getArgReference_bat(stk, pci, 0), \
335 : *bid2 = getArgReference_bat(stk, pci, 2), \
336 : *sid2 = pci->argc == 4 ? getArgReference_bat(stk, pci, 3) : NULL; \
337 : const INTYPE1 src1 = *(INTYPE1*)getArgReference(stk, pci, 1); \
338 : BATiter b2i; \
339 : DEC_SRC2(INTYPE2, 2); \
340 : DEC_OUTPUT(OUTTYPE, n); \
341 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
342 : \
343 : (void) cntxt; \
344 : (void) mb; \
345 : if ((b2 = BATdescriptor(*bid2)) == NULL) { \
346 : throw(MAL, "batmtime." MALFUNC, \
347 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
348 : } \
349 : b2i = bat_iterator(b2); \
350 : if (sid2 && !is_bat_nil(*sid2) && (s2 = BATdescriptor(*sid2)) == NULL) { \
351 : msg = createException(MAL, "batmtime." MALFUNC, \
352 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
353 : goto bailout; \
354 : } \
355 : canditer_init(&ci2, b2, s2); \
356 : if ((bn = COLnew(ci2.hseq, TYPE_##OUTTYPE, ci2.ncand, TRANSIENT)) == NULL) { \
357 : msg = createException(MAL, "batmtime." MALFUNC, \
358 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
359 : goto bailout; \
360 : } \
361 : off2 = b2->hseqbase; \
362 : INIT_SRC2(2); \
363 : INIT_OUTPUT(n); \
364 : if (ci2.tpe == cand_dense) { \
365 : for (BUN i = 0; i < ci2.ncand; i++) { \
366 : oid p2 = (canditer_next_dense(&ci2) - off2); \
367 : FUNC_CALL(FUNC, res, src1, GET_NEXT_SRC2(2, p2)); \
368 : APPEND_NEXT(MALFUNC); \
369 : nils |= is_##OUTTYPE##_nil(res); \
370 : } \
371 : } else { \
372 : for (BUN i = 0; i < ci2.ncand; i++) { \
373 : oid p2 = (canditer_next(&ci2) - off2); \
374 : FUNC_CALL(FUNC, res, src1, GET_NEXT_SRC2(2, p2)); \
375 : APPEND_NEXT(MALFUNC); \
376 : nils |= is_##OUTTYPE##_nil(res); \
377 : } \
378 : } \
379 : BATsetcount(bn, ci2.ncand); \
380 : bn->tnonil = !nils; \
381 : bn->tnil = nils; \
382 : bn->tsorted = ci2.ncand < 2; \
383 : bn->trevsorted = ci2.ncand < 2; \
384 : bn->tkey = false; \
385 : bailout: \
386 : CLEAR_EXTRA_MULTI(res); \
387 : if (b2) { \
388 : bat_iterator_end(&b2i); \
389 : BBPunfix(b2->batCacheid); \
390 : } \
391 : BBPreclaim(s2); \
392 : if (bn) { \
393 : if (msg) \
394 : BBPreclaim(bn); \
395 : else { \
396 : *ret = bn->batCacheid; \
397 : BBPkeepref(bn); \
398 : } \
399 : } \
400 : return msg; \
401 : } \
402 : static str \
403 : NAME##_bulk_p2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
404 : { \
405 : str msg = MAL_SUCCEED; \
406 : BAT *b1 = NULL, *s1 = NULL, *bn = NULL; \
407 : oid off1; \
408 : struct canditer ci1 = {0}; \
409 : bool nils = false; \
410 : bat *ret = getArgReference_bat(stk, pci, 0), \
411 : *bid1 = getArgReference_bat(stk, pci, 1), \
412 : *sid1 = pci->argc == 4 ? getArgReference_bat(stk, pci, 3) : NULL; \
413 : BATiter b1i; \
414 : DEC_SRC1(INTYPE1, 1); \
415 : const INTYPE2 src2 = *(INTYPE2*)getArgReference(stk, pci, 2); \
416 : DEC_OUTPUT(OUTTYPE, n); \
417 : DEC_EXTRA(OUTTYPE, res, MALFUNC); \
418 : \
419 : (void) cntxt; \
420 : (void) mb; \
421 : if ((b1 = BATdescriptor(*bid1)) == NULL) { \
422 : msg = createException(MAL, "batmtime." MALFUNC, \
423 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
424 : goto bailout; \
425 : } \
426 : b1i = bat_iterator(b1); \
427 : if (sid1 && !is_bat_nil(*sid1) && (s1 = BATdescriptor(*sid1)) == NULL) { \
428 : msg = createException(MAL, "batmtime." MALFUNC, \
429 : SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); \
430 : goto bailout; \
431 : } \
432 : canditer_init(&ci1, b1, s1); \
433 : if ((bn = COLnew(ci1.hseq, TYPE_##OUTTYPE, ci1.ncand, TRANSIENT)) == NULL) { \
434 : msg = createException(MAL, "batmtime." MALFUNC, \
435 : SQLSTATE(HY013) MAL_MALLOC_FAIL); \
436 : goto bailout; \
437 : } \
438 : off1 = b1->hseqbase; \
439 : INIT_SRC1(1); \
440 : INIT_OUTPUT(n); \
441 : if (ci1.tpe == cand_dense) { \
442 : for (BUN i = 0; i < ci1.ncand; i++) { \
443 : oid p1 = (canditer_next_dense(&ci1) - off1); \
444 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), src2); \
445 : APPEND_NEXT(MALFUNC); \
446 : nils |= is_##OUTTYPE##_nil(res); \
447 : } \
448 : } else { \
449 : for (BUN i = 0; i < ci1.ncand; i++) { \
450 : oid p1 = (canditer_next(&ci1) - off1); \
451 : FUNC_CALL(FUNC, res, GET_NEXT_SRC1(1, p1), src2); \
452 : APPEND_NEXT(MALFUNC); \
453 : nils |= is_##OUTTYPE##_nil(res); \
454 : } \
455 : } \
456 : BATsetcount(bn, ci1.ncand); \
457 : bn->tnonil = !nils; \
458 : bn->tnil = nils; \
459 : bn->tsorted = ci1.ncand < 2; \
460 : bn->trevsorted = ci1.ncand < 2; \
461 : bn->tkey = false; \
462 : bailout: \
463 : CLEAR_EXTRA_MULTI(res); \
464 : if (b1) { \
465 : bat_iterator_end(&b1i); \
466 : BBPunfix(b1->batCacheid); \
467 : } \
468 : BBPreclaim(s1); \
469 : if (bn) { \
470 : if (msg) \
471 : BBPreclaim(bn); \
472 : else { \
473 : *ret = bn->batCacheid; \
474 : BBPkeepref(bn); \
475 : } \
476 : } \
477 : return msg; \
478 : }
479 :
480 : #define func2_noexcept(FUNC, RET, PARAM1, PARAM2) RET = FUNC(PARAM1, PARAM2)
481 : #define func2_except(FUNC, RET, PARAM1, PARAM2) msg = FUNC(&RET, PARAM1, PARAM2); if (msg) break
482 :
483 70 : func2(MTIMEdate_diff, "diff",
484 : date, date, lng, date_diff_imp, func2_noexcept,
485 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
486 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
487 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
488 31 : func2(MTIMEdaytime_diff_msec, "diff",
489 : daytime, daytime, lng, daytime_diff, func2_noexcept,
490 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
491 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
492 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
493 28 : func2(MTIMEdate_sub_msec_interval, "date_sub_msec_interval",
494 : date, lng, date, date_sub_msec_interval, func2_except,
495 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
496 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
497 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
498 2252 : func2(MTIMEdate_add_msec_interval, "date_add_msec_interval",
499 : date, lng, date, date_add_msec_interval, func2_except,
500 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
501 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
502 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
503 9 : func2(MTIMEtimestamp_sub_msec_interval, "timestamp_sub_msec_interval",
504 : timestamp, lng, timestamp, timestamp_sub_msec_interval, func2_except,
505 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
506 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
507 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
508 468 : func2(MTIMEtimestamp_add_msec_interval, "timestamp_add_msec_interval",
509 : timestamp, lng, timestamp, timestamp_add_msec_interval, func2_except,
510 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
511 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
512 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
513 2 : func2(MTIMEodbc_timestamp_add_msec_interval_time,
514 : "odbc_timestamp_add_msec_time", daytime, lng, timestamp,
515 : odbc_timestamp_add_msec_interval_time, func2_except, DEC_VAR_R, DEC_VAR_R,
516 : DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR,
517 : GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
518 0 : func2(MTIMEodbc_timestamp_add_month_interval_time,
519 : "odbc_timestamp_add_month_time", daytime, int, timestamp,
520 : odbc_timestamp_add_month_interval_time, func2_except, DEC_VAR_R,
521 : DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT,
522 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
523 2 : func2(MTIMEodbc_timestamp_add_msec_interval_date,
524 : "odbc_timestamp_add_msec_date", date, lng, timestamp,
525 : odbc_timestamp_add_msec_interval_date, func2_except, DEC_VAR_R, DEC_VAR_R,
526 : DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR,
527 : GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
528 6 : func2(MTIMEtimestamp_sub_month_interval, "timestamp_sub_month_interval",
529 : timestamp, int, timestamp, timestamp_sub_month_interval, func2_except,
530 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN,
531 : INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE,
532 : CLEAR_NOTHING)
533 8 : func2(MTIMEtimestamp_add_month_interval, "timestamp_add_month_interval",
534 : timestamp, int, timestamp, timestamp_add_month_interval, func2_except,
535 : DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN,
536 : INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE,
537 : CLEAR_NOTHING)
538 4 : func2(MTIMEtime_sub_msec_interval, "time_sub_msec_interval", daytime, lng,
539 : daytime, time_sub_msec_interval, func2_noexcept, DEC_VAR_R, DEC_VAR_R,
540 : DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR,
541 : GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
542 16 : func2(MTIMEtime_add_msec_interval, "time_add_msec_interval", daytime, lng,
543 : daytime, time_add_msec_interval, func2_noexcept, DEC_VAR_R, DEC_VAR_R,
544 : DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR,
545 : GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
546 7 : func2(MTIMEdate_submonths, "date_sub_month_interval", date, int, date, date_submonths,
547 : func2_except, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN,
548 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
549 : FINISH_INT_SINGLE, CLEAR_NOTHING)
550 15 : func2(MTIMEdate_addmonths, "addmonths", date, int, date, date_addmonths,
551 : func2_except, DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT, INIT_VARIN,
552 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
553 : FINISH_INT_SINGLE, CLEAR_NOTHING)
554 27 : func1(MTIMEdate_extract_century, "century", date, int, date_century,
555 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
556 : GET_NEXT_VAR)
557 8 : func1(MTIMEdate_extract_decade, "decade", date, int, date_decade,
558 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
559 : GET_NEXT_VAR)
560 2007484 : func1(MTIMEdate_extract_year, "year", date, int, date_year, COPYFLAGS,
561 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
562 : GET_NEXT_VAR)
563 36 : func1(MTIMEdate_extract_quarter, "quarter", date, bte, date_quarter,
564 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
565 : GET_NEXT_VAR)
566 2000188 : func1(MTIMEdate_extract_month, "month", date, bte, date_month, SETFLAGS,
567 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
568 : GET_NEXT_VAR)
569 2000109 : func1(MTIMEdate_extract_day, "day", date, bte, date_day, SETFLAGS,
570 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
571 : GET_NEXT_VAR)
572 40 : func1(MTIMEdate_extract_dayofyear, "dayofyear", date, sht, date_dayofyear,
573 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
574 : GET_NEXT_VAR)
575 147 : func1(MTIMEdate_extract_weekofyear, "weekofyear", date, bte,
576 : date_weekofyear, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
577 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
578 1 : func1(MTIMEdate_extract_usweekofyear, "usweekofyear", date, bte,
579 : date_usweekofyear, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
580 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
581 44 : func1(MTIMEdate_extract_dayofweek, "dayofweek", date, bte, date_dayofweek,
582 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
583 : GET_NEXT_VAR)
584 17 : func1(MTIMEdate_extract_epoch_ms, "epoch_ms", date, lng,
585 : date_to_msec_since_epoch, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
586 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
587 1900049 : func1(MTIMEdaytime_extract_hours, "hours", daytime, bte, daytime_hour,
588 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
589 : GET_NEXT_VAR)
590 2000051 : func1(MTIMEdaytime_extract_minutes, "minutes", daytime, bte,
591 : daytime_min, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN,
592 : INIT_VAROUT, GET_NEXT_VAR)
593 2000045 : func1(MTIMEdaytime_extract_sql_seconds, "sql_seconds", daytime, int,
594 : daytime_sec_usec, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
595 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
596 9 : func1(MTIMEdaytime_extract_epoch_ms, "epoch_ms", daytime, lng,
597 : daytime_to_msec_since_epoch, COPYFLAGS, func1_noexcept, DEC_VAR_R,
598 : DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
599 148 : func2(MTIMEtimestamp_diff_msec, "diff", timestamp, timestamp, lng, TSDIFF,
600 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
601 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
602 : FINISH_INT_SINGLE, CLEAR_NOTHING)
603 19 : func1(MTIMEtimestamp_century, "century", timestamp, int,
604 : timestamp_century, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
605 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
606 0 : func1(MTIMEtimestamp_decade, "decade", timestamp, int,
607 : timestamp_decade, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
608 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
609 2000080 : func1(MTIMEtimestamp_year, "year", timestamp, int, timestamp_year,
610 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
611 : GET_NEXT_VAR)
612 40 : func1(MTIMEtimestamp_quarter, "quarter", timestamp, bte,
613 : timestamp_quarter, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
614 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
615 2000707 : func1(MTIMEtimestamp_month, "month", timestamp, bte, timestamp_month,
616 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
617 : GET_NEXT_VAR)
618 2000058 : func1(MTIMEtimestamp_day, "day", timestamp, bte, timestamp_day,
619 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
620 : GET_NEXT_VAR)
621 1900128 : func1(MTIMEtimestamp_hours, "hours", timestamp, bte, timestamp_hours,
622 : SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
623 : GET_NEXT_VAR)
624 2000128 : func1(MTIMEtimestamp_minutes, "minutes", timestamp, bte,
625 : timestamp_minutes, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
626 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
627 2000143 : func1(MTIMEtimestamp_sql_seconds, "sql_seconds", timestamp, int,
628 : timestamp_extract_usecond, SETFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
629 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
630 19 : func1(MTIMEtimestamp_extract_epoch_ms, "epoch_ms", timestamp, lng,
631 : timestamp_to_msec_since_epoch, COPYFLAGS, func1_noexcept, DEC_VAR_R,
632 : DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
633 1 : func1(MTIMEsql_year, "year", int, int, sql_year, COPYFLAGS, func1_noexcept,
634 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
635 0 : func1(MTIMEsql_month, "month", int, int, sql_month, SETFLAGS,
636 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
637 : GET_NEXT_VAR)
638 3 : func1(MTIMEsql_day, "day", lng, lng, sql_day, COPYFLAGS, func1_noexcept,
639 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
640 2 : func1(MTIMEsql_hours, "hours", lng, int, sql_hours, SETFLAGS,
641 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
642 : GET_NEXT_VAR)
643 5 : func1(MTIMEsql_minutes, "minutes", lng, int, sql_minutes, SETFLAGS,
644 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
645 : GET_NEXT_VAR)
646 3 : func1(MTIMEsql_seconds, "seconds", lng, int, sql_seconds, SETFLAGS,
647 : func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
648 : GET_NEXT_VAR)
649 2 : func1(MTIMEmsec_extract_epoch_ms, "epoch_ms", lng, lng, msec_since_epoch,
650 : COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT,
651 : GET_NEXT_VAR)
652 : static inline str
653 20 : date_fromstr_func(date *ret, str s)
654 : {
655 20 : if (date_fromstr(s, &(size_t) { sizeof(date) }, &ret, false) < 0) {
656 10 : if (strNil(s))
657 10 : throw(MAL, "mtime.date_fromstr",
658 : SQLSTATE(42000) "Conversion of NULL string to date failed");
659 10 : throw(MAL, "mtime.date_fromstr",
660 : SQLSTATE(22007) "Conversion of string '%s' to date failed", s);
661 : }
662 10 : return MAL_SUCCEED;
663 : }
664 :
665 22 : func1(MTIMEdate_fromstr, "date", str, date,
666 : date_fromstr_func, SETFLAGS, func1_except,
667 : DEC_ITER, DEC_VAR_R, INIT_ITERIN, INIT_VAROUT, GET_NEXT_ITER)
668 : #define date_date(m) m
669 0 : func1(MTIMEdate_date, "date", date, date,
670 : date_date, COPYFLAGS, func1_noexcept,
671 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
672 251 : func1(MTIMEtimestamp_extract_date, "date", timestamp, date,
673 : timestamp_date, COPYFLAGS, func1_noexcept,
674 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
675 : static inline str
676 0 : timestamp_fromstr_func(timestamp *ret, str s)
677 : {
678 0 : if (timestamp_fromstr(s, &(size_t) { sizeof(timestamp) }, &ret, false) < 0)
679 0 : throw(MAL, "mtime.timestamp_fromstr", GDK_EXCEPTION);
680 0 : return MAL_SUCCEED;
681 : }
682 :
683 0 : func1(MTIMEtimestamp_fromstr, "timestamp", str, timestamp,
684 : timestamp_fromstr_func, SETFLAGS, func1_except,
685 : DEC_ITER, DEC_VAR_R, INIT_ITERIN, INIT_VAROUT, GET_NEXT_ITER)
686 : #define timestamp_timestamp(m) m
687 0 : func1(MTIMEtimestamp_timestamp, "timestamp", timestamp, timestamp,
688 : timestamp_timestamp, COPYFLAGS, func1_noexcept,
689 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
690 : #define mkts(dt) timestamp_create(dt, daytime_create(0, 0, 0, 0))
691 0 : func1(MTIMEtimestamp_fromdate, "timestamp", date, timestamp,
692 : mkts, COPYFLAGS, func1_noexcept,
693 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
694 : #define seconds_since_epoch(t) is_timestamp_nil(t) ? int_nil : (int) (timestamp_diff(t, unixepoch) / 1000000);
695 61 : func1(MTIMEseconds_since_epoch, "epoch", timestamp, int,
696 : seconds_since_epoch, COPYFLAGS, func1_noexcept,
697 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
698 : #define mktsfromsec(sec) (is_int_nil(sec) ? \
699 : timestamp_nil : \
700 : timestamp_add_usec(unixepoch, \
701 : (sec) * LL_CONSTANT(1000000)))
702 : #define mktsfrommsec(msec) (is_lng_nil(msec) ? \
703 : timestamp_nil : \
704 : timestamp_add_usec(unixepoch, \
705 : (msec) * LL_CONSTANT(1000)))
706 : /* TODO later I have to remove this call */
707 6 : func1(MTIMEtimestamp_fromsecond_epoch, "epoch", int,
708 : timestamp, mktsfromsec, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R,
709 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
710 0 : func1(MTIMEtimestamp_fromsecond, "timestamp", int, timestamp,
711 : mktsfromsec, COPYFLAGS, func1_noexcept, DEC_VAR_R, DEC_VAR_R, INIT_VARIN,
712 : INIT_VAROUT, GET_NEXT_VAR)
713 : /* TODO later I have to remove this call */
714 46 : func1(MTIMEtimestamp_frommsec_epoch, "epoch", lng, timestamp,
715 : mktsfrommsec, COPYFLAGS, func1_noexcept,
716 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
717 0 : func1(MTIMEtimestamp_frommsec, "timestamp", lng, timestamp,
718 : mktsfrommsec, COPYFLAGS, func1_noexcept,
719 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
720 : static inline str
721 3 : daytime_fromstr_func(daytime *ret, str s)
722 : {
723 3 : if (daytime_fromstr(s, &(size_t) { sizeof(daytime) }, &ret, false) < 0)
724 0 : throw(MAL, "mtime.daytime_fromstr", GDK_EXCEPTION);
725 3 : return MAL_SUCCEED;
726 : }
727 :
728 3 : func1(MTIMEdaytime_fromstr, "daytime", str, daytime,
729 : daytime_fromstr_func, SETFLAGS, func1_except,
730 : DEC_ITER, DEC_VAR_R, INIT_ITERIN, INIT_VAROUT, GET_NEXT_ITER)
731 : #define daytime_daytime(m) m
732 0 : func1(MTIMEdaytime_daytime, "daytime", daytime, daytime,
733 : daytime_daytime, COPYFLAGS, func1_noexcept,
734 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
735 : static inline str
736 0 : daytime_fromseconds(daytime *ret, lng secs)
737 : {
738 0 : if (is_lng_nil(secs))
739 0 : *ret = daytime_nil;
740 0 : else if (secs < 0 || secs >= 24 * 60 * 60)
741 0 : throw(MAL, "mtime.daytime_fromseconds",
742 : SQLSTATE(42000) ILLEGAL_ARGUMENT);
743 : else
744 0 : *ret = (daytime) (secs * 1000000);
745 : return MAL_SUCCEED;
746 : }
747 :
748 0 : func1(MTIMEdaytime_fromseconds, "daytime", lng, daytime,
749 : daytime_fromseconds, COPYFLAGS, func1_except,
750 : DEC_VAR_R, DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
751 0 : func1(MTIMEtimestamp_extract_daytime, "daytime", timestamp,
752 : daytime, timestamp_daytime, SETFLAGS, func1_noexcept, DEC_VAR_R,
753 : DEC_VAR_R, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR)
754 : /* return current system time zone offset in seconds East of Greenwich */
755 : static int
756 2 : local_timezone(int *isdstp)
757 : {
758 2 : int tzone = 0;
759 2 : int isdst = -1;
760 :
761 : #if defined(_MSC_VER)
762 : DYNAMIC_TIME_ZONE_INFORMATION tzinf;
763 :
764 : /* documentation says: UTC = localtime + Bias (in minutes),
765 : * but experimentation during DST period says, UTC = localtime
766 : * + Bias + DaylightBias, and presumably during non DST
767 : * period, UTC = localtime + Bias */
768 : switch (GetDynamicTimeZoneInformation(&tzinf)) {
769 : case TIME_ZONE_ID_STANDARD: /* using standard time */
770 : case TIME_ZONE_ID_UNKNOWN: /* no daylight saving time in this zone */
771 : isdst = 0;
772 : tzone = -(int) tzinf.Bias * 60;
773 : break;
774 : case TIME_ZONE_ID_DAYLIGHT: /* using daylight saving time */
775 : isdst = 1;
776 : tzone = -(int) (tzinf.Bias + tzinf.DaylightBias) * 60;
777 : break;
778 : default: /* aka TIME_ZONE_ID_INVALID */
779 : /* call failed, we don't know the time zone */
780 : tzone = 0;
781 : break;
782 : }
783 : #elif defined(HAVE_TM_GMTOFF)
784 2 : time_t t;
785 2 : struct tm tm = (struct tm) { 0 };
786 :
787 2 : if ((t = time(NULL)) != (time_t) - 1 && localtime_r(&t, &tm)) {
788 2 : tzone = (int) tm.tm_gmtoff;
789 2 : isdst = tm.tm_isdst;
790 : }
791 : #else
792 : time_t t;
793 : struct tm tm = (struct tm) { 0 };
794 :
795 : if ((t = time(NULL)) != (time_t) - 1 && gmtime_r(&t, &tm)) {
796 : timestamp lt, gt;
797 : gt = timestamp_create(date_create(tm.tm_year + 1900,
798 : tm.tm_mon + 1,
799 : tm.tm_mday),
800 : daytime_create(tm.tm_hour,
801 : tm.tm_min,
802 : tm.tm_sec == 60 ? 59 : tm.tm_sec,
803 : 0));
804 : if (localtime_r(&t, &tm)) {
805 : isdst = tm.tm_isdst;
806 : lt = timestamp_create(date_create(tm.tm_year + 1900,
807 : tm.tm_mon + 1,
808 : tm.tm_mday),
809 : daytime_create(tm.tm_hour,
810 : tm.tm_min,
811 : tm.tm_sec == 60 ? 59 : tm.tm_sec, 0));
812 : tzone = (int) (timestamp_diff(lt, gt) / 1000000);
813 : }
814 : }
815 : #endif
816 2 : if (isdstp)
817 2 : *isdstp = isdst;
818 2 : return tzone;
819 : }
820 :
821 : static str
822 0 : MTIMElocal_timezone_msec(lng *ret)
823 : {
824 0 : int tzone = local_timezone(NULL);
825 0 : *ret = (lng) tzone *1000;
826 0 : return MAL_SUCCEED;
827 : }
828 :
829 : static str
830 49 : timestamp_to_str(str *buf, const timestamp *d, str *format, const char *type,
831 : const char *malfunc)
832 : {
833 49 : date dt;
834 49 : daytime t;
835 49 : struct tm tm;
836 :
837 49 : if (is_timestamp_nil(*d) || strNil(*format)) {
838 4 : strcpy(*buf, str_nil);
839 4 : return MAL_SUCCEED;
840 : }
841 45 : dt = timestamp_date(*d);
842 45 : t = timestamp_daytime(*d);
843 45 : tm = (struct tm) {
844 45 : .tm_year = date_year(dt) - 1900,
845 45 : .tm_mon = date_month(dt) - 1,
846 45 : .tm_mday = date_day(dt),
847 45 : .tm_wday = date_dayofweek(dt) % 7,
848 45 : .tm_yday = date_dayofyear(dt) - 1,
849 45 : .tm_hour = daytime_hour(t),
850 45 : .tm_min = daytime_min(t),
851 45 : .tm_sec = daytime_sec(t),
852 : };
853 45 : if (strftime(*buf, MTIME_STR_BUFFER_LENGTH, *format, &tm) == 0)
854 0 : throw(MAL, malfunc, "cannot convert %s", type);
855 : return MAL_SUCCEED;
856 : }
857 :
858 : static str
859 211 : str_to_timestamp(timestamp *ret, str *s, str *format, const char *type,
860 : const char *malfunc)
861 : {
862 211 : struct tm tm = (struct tm) { 0 };
863 :
864 422 : if (strNil(*s) || strNil(*format)) {
865 0 : *ret = timestamp_nil;
866 0 : return MAL_SUCCEED;
867 : }
868 211 : tm.tm_sec = tm.tm_min = tm.tm_hour = 0;
869 211 : tm.tm_isdst = -1;
870 211 : tm.tm_mday = 1;
871 211 : if (strptime(*s, *format, &tm) == NULL)
872 0 : throw(MAL, malfunc,
873 : "format '%s', doesn't match %s '%s'", *format, type, *s);
874 422 : *ret = timestamp_create(date_create(tm.tm_year + 1900,
875 211 : tm.tm_mon + 1,
876 : tm.tm_mday),
877 : daytime_create(tm.tm_hour,
878 : tm.tm_min,
879 211 : tm.tm_sec == 60 ? 59 : tm.tm_sec,
880 : 0));
881 : /* if strptime filled in DST information (tm_isdst >= 0), then the
882 : * time is in system local time and we convert to GMT by
883 : * subtracting the time zone offset, else we don't touch the time
884 : * returned because it is assumed to already be in GMT */
885 211 : if (tm.tm_isdst >= 0) {
886 2 : int isdst = 0;
887 2 : int tz = local_timezone(&isdst);
888 : /* if strptime's information doesn't square with our own
889 : * information about having or not having DST, we compensate
890 : * an hour */
891 2 : if (tm.tm_isdst > 0 && isdst == 0) {
892 0 : tz += 3600;
893 2 : } else if (tm.tm_isdst == 0 && isdst > 0) {
894 2 : tz -= 3600;
895 : }
896 :
897 2 : *ret = timestamp_add_usec(*ret, -tz * LL_CONSTANT(1000000));
898 : }
899 211 : if (is_timestamp_nil(*ret))
900 0 : throw(MAL, malfunc, "bad %s '%s'", type, *s);
901 : return MAL_SUCCEED;
902 : }
903 :
904 : static inline str
905 196 : str_to_date(date *ret, str s, str format)
906 : {
907 196 : str msg = MAL_SUCCEED;
908 196 : timestamp ts;
909 196 : if ((msg = str_to_timestamp(&ts, &s, &format, "date",
910 : "mtime.str_to_date")) != MAL_SUCCEED)
911 : return msg;
912 196 : *ret = timestamp_date(ts);
913 196 : return MAL_SUCCEED;
914 : }
915 :
916 197 : func2(MTIMEstr_to_date, "str_to_date",
917 : str, str, date, str_to_date, func2_except,
918 : DEC_ITER, DEC_ITER, DEC_VAR_R, DEC_INT,
919 : INIT_ITERIN, INIT_ITERIN, INIT_VAROUT,
920 : GET_NEXT_ITER, GET_NEXT_ITER,
921 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
922 : static inline str
923 2 : str_to_time(daytime *ret, str s, str format)
924 : {
925 2 : str msg = MAL_SUCCEED;
926 2 : timestamp ts;
927 2 : if ((msg = str_to_timestamp(&ts, &s, &format, "time",
928 : "mtime.str_to_time")) != MAL_SUCCEED)
929 : return msg;
930 2 : *ret = timestamp_daytime(ts);
931 2 : return MAL_SUCCEED;
932 : }
933 :
934 2 : func2(MTIMEstr_to_time, "str_to_time",
935 : str, str, daytime, str_to_time, func2_except,
936 : DEC_ITER, DEC_ITER, DEC_VAR_R, DEC_INT,
937 : INIT_ITERIN, INIT_ITERIN, INIT_VAROUT,
938 : GET_NEXT_ITER, GET_NEXT_ITER,
939 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
940 : static inline str
941 13 : str_to_timestamp_func(timestamp *ret, str s, str format)
942 : {
943 13 : return str_to_timestamp(ret, &s, &format, "timestamp",
944 : "mtime.str_to_timestamp");
945 : }
946 :
947 13 : func2(MTIMEstr_to_timestamp, "str_to_timestamp",
948 : str, str, timestamp, str_to_timestamp_func, func2_except,
949 : DEC_ITER, DEC_ITER, DEC_VAR_R, DEC_INT,
950 : INIT_ITERIN, INIT_ITERIN, INIT_VAROUT,
951 : GET_NEXT_ITER, GET_NEXT_ITER,
952 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
953 : static inline str
954 34 : date_to_str(str *ret, date d, str format)
955 : {
956 34 : timestamp ts = timestamp_create(d, timestamp_daytime(timestamp_current()));
957 34 : return timestamp_to_str(ret, &ts, &format, "date", "mtime.date_to_str");
958 : }
959 :
960 44 : func2(MTIMEdate_to_str, "date_to_str",
961 : date, str, str, date_to_str, func2_except,
962 : DEC_VAR, DEC_ITER, DEC_NOTHING, DEC_BUFFER,
963 : INIT_VARIN, INIT_ITERIN, INIT_NOTHING,
964 : GET_NEXT_VAR, GET_NEXT_ITER,
965 : APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI)
966 : static inline str
967 1 : time_to_str(str *ret, daytime d, str format)
968 : {
969 1 : timestamp ts = timestamp_create(timestamp_date(timestamp_current()), d);
970 1 : return timestamp_to_str(ret, &ts, &format, "time", "mtime.time_to_str");
971 : }
972 :
973 1 : func2(MTIMEtime_to_str, "time_to_str",
974 : daytime, str, str, time_to_str, func2_except,
975 : DEC_VAR, DEC_ITER, DEC_NOTHING, DEC_BUFFER,
976 : INIT_VARIN, INIT_ITERIN, INIT_NOTHING,
977 : GET_NEXT_VAR, GET_NEXT_ITER,
978 : APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI)
979 : static inline str
980 14 : timestamp_to_str_func(str *ret, timestamp d, str format)
981 : {
982 14 : return timestamp_to_str(ret, &d, &format, "timestamp",
983 : "mtime.timestamp_to_str");
984 : }
985 :
986 22 : func2(MTIMEtimestamp_to_str, "timestamp_to_str",
987 : timestamp, str, str, timestamp_to_str_func, func2_except,
988 : DEC_VAR, DEC_ITER, DEC_NOTHING, DEC_BUFFER,
989 : INIT_VARIN, INIT_ITERIN, INIT_NOTHING,
990 : GET_NEXT_VAR, GET_NEXT_ITER,
991 : APPEND_STR, FINISH_BUFFER_SINGLE, FINISH_BUFFER_MULTI)
992 : static inline lng
993 5 : timestampdiff_sec(timestamp t1, timestamp t2)
994 : {
995 5 : return TSDIFF(t1, t2) / 1000;
996 : }
997 :
998 :
999 : static inline lng
1000 1 : timestampdiff_sec_date_timestamp(date d, timestamp ts)
1001 : {
1002 1 : return timestampdiff_sec(timestamp_fromdate(d), ts);
1003 : }
1004 :
1005 :
1006 : static inline lng
1007 1 : timestampdiff_sec_timestamp_date(timestamp ts, date d)
1008 : {
1009 1 : return timestampdiff_sec(ts, timestamp_fromdate(d));
1010 : }
1011 :
1012 :
1013 : static inline lng
1014 4 : timestampdiff_min(timestamp t1, timestamp t2)
1015 : {
1016 4 : return TSDIFF(t1, t2) / 1000 / 60;
1017 : }
1018 :
1019 : static inline lng
1020 1 : timestampdiff_min_date_timestamp(date d, timestamp ts)
1021 : {
1022 1 : return timestampdiff_min(timestamp_fromdate(d), ts);
1023 : }
1024 :
1025 : static inline lng
1026 1 : timestampdiff_min_timestamp_date(timestamp ts, date d)
1027 : {
1028 1 : return timestampdiff_min(ts, timestamp_fromdate(d));
1029 : }
1030 :
1031 : static inline lng
1032 4 : timestampdiff_hour(timestamp t1, timestamp t2)
1033 : {
1034 4 : return TSDIFF(t1, t2) / 1000 / 60 / 60;
1035 : }
1036 :
1037 : static inline lng
1038 1 : timestampdiff_hour_date_timestamp(date d, timestamp ts)
1039 : {
1040 1 : return timestampdiff_hour(timestamp_fromdate(d), ts);
1041 : }
1042 :
1043 : static inline lng
1044 1 : timestampdiff_hour_timestamp_date(timestamp ts, date d)
1045 : {
1046 1 : return timestampdiff_hour(ts, timestamp_fromdate(d));
1047 : }
1048 :
1049 : static inline int
1050 4 : timestampdiff_day(timestamp t1, timestamp t2)
1051 : {
1052 4 : return date_diff(timestamp_date(t1), timestamp_date(t2));
1053 : }
1054 :
1055 : static inline int
1056 1 : timestampdiff_day_time_timestamp(daytime t, timestamp ts)
1057 : {
1058 1 : date today = timestamp_date(timestamp_current());
1059 1 : return timestampdiff_day(timestamp_create(today, t), ts);
1060 : }
1061 :
1062 : static inline int
1063 1 : timestampdiff_day_timestamp_time(timestamp ts, daytime t)
1064 : {
1065 1 : date today = timestamp_date(timestamp_current());
1066 1 : return timestampdiff_day(ts, timestamp_create(today, t));
1067 : }
1068 :
1069 : static inline int
1070 4 : timestampdiff_week(timestamp t1, timestamp t2)
1071 : {
1072 4 : return date_diff(timestamp_date(t1), timestamp_date(t2)) / 7;
1073 : }
1074 :
1075 : static inline int
1076 0 : timestampdiff_week_time_timestamp(daytime t, timestamp ts)
1077 : {
1078 0 : date today = timestamp_date(timestamp_current());
1079 0 : return timestampdiff_week(timestamp_create(today, t), ts);
1080 : }
1081 :
1082 : static inline int
1083 2 : timestampdiff_week_timestamp_time(timestamp ts, daytime t)
1084 : {
1085 2 : date today = timestamp_date(timestamp_current());
1086 2 : return timestampdiff_week(ts, timestamp_create(today, t));
1087 : }
1088 :
1089 : static inline int
1090 5 : timestampdiff_month(timestamp t1, timestamp t2)
1091 : {
1092 5 : date d1 = timestamp_date(t1);
1093 5 : date d2 = timestamp_date(t2);
1094 5 : return ((date_year(d1) - date_year(d2)) * 12) + (date_month(d1) -
1095 5 : date_month(d2));
1096 : }
1097 :
1098 : static inline int
1099 1 : timestampdiff_month_time_timestamp(daytime t, timestamp ts)
1100 : {
1101 1 : date today = timestamp_date(timestamp_current());
1102 1 : return timestampdiff_month(timestamp_create(today, t), ts);
1103 : }
1104 :
1105 : static inline int
1106 1 : timestampdiff_month_timestamp_time(timestamp ts, daytime t)
1107 : {
1108 1 : date today = timestamp_date(timestamp_current());
1109 1 : return timestampdiff_month(ts, timestamp_create(today, t));
1110 : }
1111 :
1112 : static inline int
1113 5 : timestampdiff_quarter(timestamp t1, timestamp t2)
1114 : {
1115 5 : date d1 = timestamp_date(t1);
1116 5 : date d2 = timestamp_date(t2);
1117 5 : return ((date_year(d1) - date_year(d2)) * 4) + (date_quarter(d1) -
1118 5 : date_quarter(d2));
1119 : }
1120 :
1121 : static inline int
1122 1 : timestampdiff_quarter_time_timestamp(daytime t, timestamp ts)
1123 : {
1124 1 : date today = timestamp_date(timestamp_current());
1125 1 : return timestampdiff_quarter(timestamp_create(today, t), ts);
1126 : }
1127 :
1128 : static inline int
1129 1 : timestampdiff_quarter_timestamp_time(timestamp ts, daytime t)
1130 : {
1131 1 : date today = timestamp_date(timestamp_current());
1132 1 : return timestampdiff_quarter(ts, timestamp_create(today, t));
1133 : }
1134 :
1135 : static inline int
1136 4 : timestampdiff_year(timestamp t1, timestamp t2)
1137 : {
1138 4 : date d1 = timestamp_date(t1);
1139 4 : date d2 = timestamp_date(t2);
1140 4 : return date_year(d1) - date_year(d2);
1141 : }
1142 :
1143 : static inline int
1144 1 : timestampdiff_year_time_timestamp(daytime t, timestamp ts)
1145 : {
1146 1 : date today = timestamp_date(timestamp_current());
1147 1 : return timestampdiff_year(timestamp_create(today, t), ts);
1148 : }
1149 :
1150 : static inline int
1151 1 : timestampdiff_year_timestamp_time(timestamp ts, daytime t)
1152 : {
1153 1 : date today = timestamp_date(timestamp_current());
1154 1 : return timestampdiff_year(ts, timestamp_create(today, t));
1155 : }
1156 :
1157 : // odbc timestampdiff variants
1158 3 : func2(MTIMEtimestampdiff_sec, "timestampdiff_sec",
1159 : timestamp, timestamp, lng, timestampdiff_sec, func2_noexcept,
1160 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1161 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1162 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1163 1 : func2(MTIMEtimestampdiff_sec_d_ts, "timestampdiff_sec",
1164 : date, timestamp, lng, timestampdiff_sec_date_timestamp, func2_noexcept,
1165 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1166 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1167 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1168 1 : func2(MTIMEtimestampdiff_sec_ts_d, "timestampdiff_sec",
1169 : timestamp, date, lng, timestampdiff_sec_timestamp_date, func2_noexcept,
1170 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1171 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1172 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1173 2 : func2(MTIMEtimestampdiff_min, "timestampdiff_min",
1174 : timestamp, timestamp, lng, timestampdiff_min, func2_noexcept,
1175 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1176 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1177 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1178 1 : func2(MTIMEtimestampdiff_min_d_ts, "timestampdiff_min",
1179 : date, timestamp, lng, timestampdiff_min_date_timestamp, func2_noexcept,
1180 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1181 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1182 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1183 1 : func2(MTIMEtimestampdiff_min_ts_d, "timestampdiff_min",
1184 : timestamp, date, lng, timestampdiff_min_timestamp_date, func2_noexcept,
1185 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1186 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1187 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1188 2 : func2(MTIMEtimestampdiff_hour, "timestampdiff_hour",
1189 : timestamp, timestamp, lng, timestampdiff_hour, func2_noexcept,
1190 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1191 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1192 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1193 1 : func2(MTIMEtimestampdiff_hour_d_ts, "timestampdiff_hour",
1194 : date, timestamp, lng, timestampdiff_hour_date_timestamp, func2_noexcept,
1195 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1196 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1197 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1198 1 : func2(MTIMEtimestampdiff_hour_ts_d, "timestampdiff_hour",
1199 : timestamp, date, lng, timestampdiff_hour_timestamp_date, func2_noexcept,
1200 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1201 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1202 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1203 2 : func2(MTIMEtimestampdiff_day, "timestampdiff_day",
1204 : timestamp, timestamp, int, timestampdiff_day, func2_noexcept,
1205 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1206 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1207 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1208 1 : func2(MTIMEtimestampdiff_day_t_ts, "timestampdiff_day",
1209 : daytime, timestamp, int, timestampdiff_day_time_timestamp, func2_noexcept,
1210 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1211 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1212 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1213 1 : func2(MTIMEtimestampdiff_day_ts_t, "timestampdiff_day",
1214 : timestamp, daytime, int, timestampdiff_day_timestamp_time, func2_noexcept,
1215 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1216 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1217 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1218 2 : func2(MTIMEtimestampdiff_week, "timestampdiff_week",
1219 : timestamp, timestamp, int, timestampdiff_week, func2_noexcept,
1220 : DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1221 : INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1222 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1223 0 : func2(MTIMEtimestampdiff_week_t_ts, "timestampdiff_week",
1224 : daytime, timestamp, int, timestampdiff_week_time_timestamp,
1225 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1226 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1227 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1228 2 : func2(MTIMEtimestampdiff_week_ts_t, "timestampdiff_week", timestamp,
1229 : daytime, int, timestampdiff_week_timestamp_time, func2_noexcept, DEC_VAR,
1230 : DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT,
1231 : GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1232 3 : func2(MTIMEtimestampdiff_month, "timestampdiff_month", timestamp, timestamp,
1233 : int, timestampdiff_month, func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R,
1234 : DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR,
1235 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1236 1 : func2(MTIMEtimestampdiff_month_t_ts, "timestampdiff_month",
1237 : daytime, timestamp, int, timestampdiff_month_time_timestamp,
1238 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1239 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1240 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1241 1 : func2(MTIMEtimestampdiff_month_ts_t, "timestampdiff_month",
1242 : timestamp, daytime, int, timestampdiff_month_timestamp_time,
1243 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1244 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1245 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1246 3 : func2(MTIMEtimestampdiff_quarter, "timestampdiff_quarter", timestamp, timestamp,
1247 : int, timestampdiff_quarter, func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R,
1248 : DEC_INT, INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR,
1249 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1250 1 : func2(MTIMEtimestampdiff_quarter_t_ts, "timestampdiff_quarter",
1251 : daytime, timestamp, int, timestampdiff_quarter_time_timestamp,
1252 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1253 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1254 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1255 1 : func2(MTIMEtimestampdiff_quarter_ts_t, "timestampdiff_quarter",
1256 : timestamp, daytime, int, timestampdiff_quarter_timestamp_time,
1257 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1258 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1259 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1260 2 : func2(MTIMEtimestampdiff_year, "timestampdiff_year", timestamp, timestamp, int,
1261 : timestampdiff_year, func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
1262 : INIT_VARIN, INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR,
1263 : APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
1264 1 : func2(MTIMEtimestampdiff_year_t_ts, "timestampdiff_year",
1265 : daytime, timestamp, int, timestampdiff_year_time_timestamp,
1266 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1267 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1268 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1269 1 : func2(MTIMEtimestampdiff_year_ts_t, "timestampdiff_year",
1270 : timestamp, daytime, int, timestampdiff_year_timestamp_time,
1271 : func2_noexcept, DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT, INIT_VARIN,
1272 : INIT_VARIN, INIT_VAROUT, GET_NEXT_VAR, GET_NEXT_VAR, APPEND_VAR,
1273 : FINISH_INT_SINGLE, CLEAR_NOTHING)
1274 :
1275 : #include "mel.h"
1276 : static mel_func mtime_init_funcs[] = {
1277 : command("mtime", "epoch", MTIMEseconds_since_epoch, false, "unix-time (epoch) support: seconds since epoch", args(1,2, arg("",int),arg("t",timestamp))),
1278 : pattern("batmtime", "epoch", MTIMEseconds_since_epoch_bulk, false, "", args(1,2, batarg("",int),batarg("t",timestamp))),
1279 : pattern("batmtime", "epoch", MTIMEseconds_since_epoch_bulk, false, "", args(1,3, batarg("",int),batarg("t",timestamp),batarg("s",oid))),
1280 : command("mtime", "epoch", MTIMEtimestamp_fromsecond_epoch, false, "convert seconds since epoch into a timestamp", args(1,2, arg("",timestamp),arg("t",int))),
1281 : pattern("batmtime", "epoch", MTIMEtimestamp_fromsecond_epoch_bulk, false, "", args(1,2, batarg("",timestamp),batarg("t",int))),
1282 : pattern("batmtime", "epoch", MTIMEtimestamp_fromsecond_epoch_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",int),batarg("s",oid))),
1283 : command("mtime", "epoch", MTIMEtimestamp_frommsec_epoch, false, "convert milliseconds since epoch into a timestamp", args(1,2, arg("",timestamp),arg("t",lng))),
1284 : pattern("batmtime", "epoch", MTIMEtimestamp_frommsec_epoch_bulk, false, "", args(1,2, batarg("",timestamp),batarg("t",lng))),
1285 : pattern("batmtime", "epoch", MTIMEtimestamp_frommsec_epoch_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",lng),batarg("s",oid))),
1286 : command("mtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval, false, "", args(1,3, arg("",date),arg("t",date),arg("ms",lng))),
1287 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk, false, "", args(1,3, batarg("",date),batarg("t",date),batarg("ms",lng))),
1288 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk_p1, false, "", args(1,3, batarg("",date),arg("t",date),batarg("ms",lng))),
1289 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk_p2, false, "", args(1,3, batarg("",date),batarg("t",date),arg("ms",lng))),
1290 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk, false, "", args(1,5, batarg("",date),batarg("t",date),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1291 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk_p1, false, "", args(1,4, batarg("",date),arg("t",date),batarg("ms",lng),batarg("s",oid))),
1292 : pattern("batmtime", "date_sub_msec_interval", MTIMEdate_sub_msec_interval_bulk_p2, false, "", args(1,4, batarg("",date),batarg("t",date),arg("ms",lng),batarg("s",oid))),
1293 : command("mtime", "date_add_msec_interval", MTIMEdate_add_msec_interval, false, "", args(1,3, arg("",date),arg("t",date),arg("ms",lng))),
1294 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk, false, "", args(1,3, batarg("",date),batarg("t",date),batarg("ms",lng))),
1295 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk_p1, false, "", args(1,3, batarg("",date),arg("t",date),batarg("ms",lng))),
1296 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk_p2, false, "", args(1,3, batarg("",date),batarg("t",date),arg("ms",lng))),
1297 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk, false, "", args(1,5, batarg("",date),batarg("t",date),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1298 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk_p1, false, "", args(1,4, batarg("",date),arg("t",date),batarg("ms",lng),batarg("s",oid))),
1299 : pattern("batmtime", "date_add_msec_interval", MTIMEdate_add_msec_interval_bulk_p2, false, "", args(1,4, batarg("",date),batarg("t",date),arg("ms",lng),batarg("s",oid))),
1300 : command("mtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval, false, "", args(1,3, arg("",timestamp),arg("t",timestamp),arg("ms",lng))),
1301 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("ms",lng))),
1302 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("ms",lng))),
1303 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),arg("ms",lng))),
1304 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1305 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("ms",lng),batarg("s",oid))),
1306 : pattern("batmtime", "timestamp_sub_msec_interval", MTIMEtimestamp_sub_msec_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("ms",lng),batarg("s",oid))),
1307 : command("mtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval, false, "", args(1,3, arg("",timestamp),arg("t",timestamp),arg("ms",lng))),
1308 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("ms",lng))),
1309 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("ms",lng))),
1310 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),arg("ms",lng))),
1311 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1312 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("ms",lng),batarg("s",oid))),
1313 : pattern("batmtime", "timestamp_add_msec_interval", MTIMEtimestamp_add_msec_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("ms",lng),batarg("s",oid))),
1314 : command("mtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval, false, "Subtract months from a timestamp", args(1,3, arg("",timestamp),arg("t",timestamp),arg("s",int))),
1315 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("s",int))),
1316 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("s",int))),
1317 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),arg("s",int))),
1318 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("s",int),batarg("s1",oid),batarg("s2",oid))),
1319 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("s",int),batarg("s",oid))),
1320 : pattern("batmtime", "timestamp_sub_month_interval", MTIMEtimestamp_sub_month_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("s",int),batarg("s",oid))),
1321 : // --
1322 : command("mtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval, false, "Add months to a timestamp", args(1,3, arg("",timestamp),arg("t",timestamp),arg("s",int))),
1323 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("s",int))),
1324 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",timestamp),batarg("s",int))),
1325 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),arg("s",int))),
1326 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",timestamp),batarg("s",int),batarg("s1",oid),batarg("s2",oid))),
1327 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",timestamp),batarg("s",int),batarg("s",oid))),
1328 : pattern("batmtime", "timestamp_add_month_interval", MTIMEtimestamp_add_month_interval_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",timestamp),arg("s",int),batarg("s",oid))),
1329 : // odbc timestampadd corner cases
1330 : command("mtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time, false, "", args(1,3, arg("",timestamp),arg("t",daytime),arg("ms",lng))),
1331 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),batarg("ms",lng))),
1332 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",daytime),batarg("ms",lng))),
1333 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),arg("ms",lng))),
1334 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",daytime),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1335 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",daytime),batarg("ms",lng),batarg("s",oid))),
1336 : pattern("batmtime", "odbc_timestamp_add_msec_time", MTIMEodbc_timestamp_add_msec_interval_time_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",daytime),arg("ms",lng),batarg("s",oid))),
1337 : // --
1338 : command("mtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time, false, "Add months to a time", args(1,3, arg("",timestamp),arg("t",daytime),arg("s",int))),
1339 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),batarg("s",int))),
1340 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("t",daytime),batarg("s",int))),
1341 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("t",daytime),arg("s",int))),
1342 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk, false, "", args(1,5, batarg("",timestamp),batarg("t",daytime),batarg("s",int),batarg("s1",oid),batarg("s2",oid))),
1343 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("t",daytime),batarg("s",int),batarg("s",oid))),
1344 : pattern("batmtime", "odbc_timestamp_add_month_time", MTIMEodbc_timestamp_add_month_interval_time_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("t",daytime),arg("s",int),batarg("s",oid))),
1345 : // --
1346 : command("mtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date, false, "", args(1,3, arg("",timestamp),arg("d",date),arg("ms",lng))),
1347 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk, false, "", args(1,3, batarg("",timestamp),batarg("d",date),batarg("ms",lng))),
1348 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("d",date),batarg("ms",lng))),
1349 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("d",date),arg("ms",lng))),
1350 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk, false, "", args(1,5, batarg("",timestamp),batarg("d",date),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1351 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("d",date),batarg("ms",lng),batarg("s",oid))),
1352 : pattern("batmtime", "odbc_timestamp_add_msec_date", MTIMEodbc_timestamp_add_msec_interval_date_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("d",date),arg("ms",lng),batarg("s",oid))),
1353 : // end odbc timestampadd corner cases
1354 : command("mtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval, false, "Subtract seconds from a time", args(1,3, arg("",daytime),arg("t",daytime),arg("ms",lng))),
1355 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),batarg("ms",lng))),
1356 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk_p1, false, "", args(1,3, batarg("",daytime),arg("t",daytime),batarg("ms",lng))),
1357 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk_p2, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),arg("ms",lng))),
1358 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk, false, "", args(1,5, batarg("",daytime),batarg("t",daytime),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1359 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk_p1, false, "", args(1,4, batarg("",daytime),arg("t",daytime),batarg("ms",lng),batarg("s",oid))),
1360 : pattern("batmtime", "time_sub_msec_interval", MTIMEtime_sub_msec_interval_bulk_p2, false, "", args(1,4, batarg("",daytime),batarg("t",daytime),arg("ms",lng),batarg("s",oid))),
1361 : command("mtime", "time_add_msec_interval", MTIMEtime_add_msec_interval, false, "Add seconds to a time", args(1,3, arg("",daytime),arg("t",daytime),arg("ms",lng))),
1362 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),batarg("ms",lng))),
1363 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p1, false, "", args(1,3, batarg("",daytime),arg("t",daytime),batarg("ms",lng))),
1364 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p2, false, "", args(1,3, batarg("",daytime),batarg("t",daytime),arg("ms",lng))),
1365 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk, false, "", args(1,5, batarg("",daytime),batarg("t",daytime),batarg("ms",lng),batarg("s1",oid),batarg("s2",oid))),
1366 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p1, false, "", args(1,4, batarg("",daytime),arg("t",daytime),batarg("ms",lng),batarg("s",oid))),
1367 : pattern("batmtime", "time_add_msec_interval", MTIMEtime_add_msec_interval_bulk_p2, false, "", args(1,4, batarg("",daytime),batarg("t",daytime),arg("ms",lng),batarg("s",oid))),
1368 : command("mtime", "diff", MTIMEdaytime_diff_msec, false, "returns the number of msec between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",daytime),arg("val2",daytime))),
1369 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",daytime),batarg("val2",daytime))),
1370 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",daytime),batarg("val2",daytime))),
1371 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",daytime),arg("val2",daytime))),
1372 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",daytime),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
1373 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",daytime),batarg("val2",daytime),batarg("s",oid))),
1374 : pattern("batmtime", "diff", MTIMEdaytime_diff_msec_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",daytime),arg("val2",daytime),batarg("s",oid))),
1375 : command("mtime", "date_sub_month_interval", MTIMEdate_submonths, false, "Subtract months from a date", args(1,3, arg("",date),arg("t",date),arg("months",int))),
1376 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk, false, "", args(1,3, batarg("",date),batarg("t",date),batarg("months",int))),
1377 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p1, false, "", args(1,3, batarg("",date),arg("t",date),batarg("months",int))),
1378 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p2, false, "", args(1,3, batarg("",date),batarg("t",date),arg("months",int))),
1379 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk, false, "", args(1,5, batarg("",date),batarg("t",date),batarg("months",int),batarg("s1",oid),batarg("s2",oid))),
1380 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p1, false, "", args(1,4, batarg("",date),arg("t",date),batarg("months",int),batarg("s",oid))),
1381 : pattern("batmtime", "date_sub_month_interval", MTIMEdate_submonths_bulk_p2, false, "", args(1,4, batarg("",date),batarg("t",date),arg("months",int),batarg("s",oid))),
1382 : command("mtime", "local_timezone", MTIMElocal_timezone_msec, false, "get the local timezone in seconds", args(1,1, arg("",lng))),
1383 : command("mtime", "century", MTIMEdate_extract_century, false, "extracts century from date.", args(1,2, arg("",int),arg("d",date))),
1384 : pattern("batmtime", "century", MTIMEdate_extract_century_bulk, false, "", args(1,2, batarg("",int),batarg("d",date))),
1385 : pattern("batmtime", "century", MTIMEdate_extract_century_bulk, false, "", args(1,3, batarg("",int),batarg("d",date),batarg("s",oid))),
1386 : command("mtime", "decade", MTIMEdate_extract_decade, false, "extracts decade from date.", args(1,2, arg("",int),arg("d",date))),
1387 : pattern("batmtime", "decade", MTIMEdate_extract_decade_bulk, false, "", args(1,2, batarg("",int),batarg("d",date))),
1388 : pattern("batmtime", "decade", MTIMEdate_extract_decade_bulk, false, "", args(1,3, batarg("",int),batarg("d",date),batarg("s",oid))),
1389 : command("mtime", "year", MTIMEdate_extract_year, false, "extracts year from date.", args(1,2, arg("",int),arg("d",date))),
1390 : pattern("batmtime", "year", MTIMEdate_extract_year_bulk, false, "", args(1,2, batarg("",int),batarg("d",date))),
1391 : pattern("batmtime", "year", MTIMEdate_extract_year_bulk, false, "", args(1,3, batarg("",int),batarg("d",date),batarg("s",oid))),
1392 : command("mtime", "quarter", MTIMEdate_extract_quarter, false, "extracts quarter from date", args(1,2, arg("",bte),arg("d",date))),
1393 : pattern("batmtime", "quarter", MTIMEdate_extract_quarter_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1394 : pattern("batmtime", "quarter", MTIMEdate_extract_quarter_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1395 : command("mtime", "month", MTIMEdate_extract_month, false, "extracts month from date", args(1,2, arg("",bte),arg("d",date))),
1396 : pattern("batmtime", "month", MTIMEdate_extract_month_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1397 : pattern("batmtime", "month", MTIMEdate_extract_month_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1398 : command("mtime", "day", MTIMEdate_extract_day, false, "extracts day from date ", args(1,2, arg("",bte),arg("d",date))),
1399 : pattern("batmtime", "day", MTIMEdate_extract_day_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1400 : pattern("batmtime", "day", MTIMEdate_extract_day_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1401 : command("mtime", "epoch_ms", MTIMEdate_extract_epoch_ms, false, "", args(1,2, arg("",lng),arg("d",date))),
1402 : pattern("batmtime", "epoch_ms", MTIMEdate_extract_epoch_ms_bulk, false, "", args(1,2, batarg("",lng),batarg("d",date))),
1403 : pattern("batmtime", "epoch_ms", MTIMEdate_extract_epoch_ms_bulk, false, "", args(1,3, batarg("",lng),batarg("d",date),batarg("s",oid))),
1404 : command("mtime", "hours", MTIMEdaytime_extract_hours, false, "extracts hour from daytime", args(1,2, arg("",bte),arg("h",daytime))),
1405 : pattern("batmtime", "hours", MTIMEdaytime_extract_hours_bulk, false, "", args(1,2, batarg("",bte),batarg("d",daytime))),
1406 : pattern("batmtime", "hours", MTIMEdaytime_extract_hours_bulk, false, "", args(1,3, batarg("",bte),batarg("d",daytime),batarg("s",oid))),
1407 : command("mtime", "minutes", MTIMEdaytime_extract_minutes, false, "extracts minutes from daytime", args(1,2, arg("",bte),arg("d",daytime))),
1408 : pattern("batmtime", "minutes", MTIMEdaytime_extract_minutes_bulk, false, "", args(1,2, batarg("",bte),batarg("d",daytime))),
1409 : pattern("batmtime", "minutes", MTIMEdaytime_extract_minutes_bulk, false, "", args(1,3, batarg("",bte),batarg("d",daytime),batarg("s",oid))),
1410 : command("mtime", "sql_seconds", MTIMEdaytime_extract_sql_seconds, false, "extracts seconds (with fractional milliseconds) from daytime", args(1,2, arg("",int),arg("d",daytime))),
1411 : pattern("batmtime", "sql_seconds", MTIMEdaytime_extract_sql_seconds_bulk, false, "", args(1,2, batarg("",int),batarg("d",daytime))),
1412 : pattern("batmtime", "sql_seconds", MTIMEdaytime_extract_sql_seconds_bulk, false, "", args(1,3, batarg("",int),batarg("d",daytime),batarg("s",oid))),
1413 : command("mtime", "epoch_ms", MTIMEdaytime_extract_epoch_ms, false, "", args(1,2, arg("",lng),arg("d",daytime))),
1414 : pattern("batmtime", "epoch_ms", MTIMEdaytime_extract_epoch_ms_bulk, false, "", args(1,2, batarg("",lng),batarg("d",daytime))),
1415 : pattern("batmtime", "epoch_ms", MTIMEdaytime_extract_epoch_ms_bulk, false, "", args(1,3, batarg("",lng),batarg("d",daytime),batarg("s",oid))),
1416 : command("mtime", "addmonths", MTIMEdate_addmonths, false, "returns the date after a number of\nmonths (possibly negative).", args(1,3, arg("",date),arg("value",date),arg("months",int))),
1417 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk, false, "", args(1,3, batarg("",date),batarg("value",date),batarg("months",int))),
1418 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p1, false, "", args(1,3, batarg("",date),arg("value",date),batarg("months",int))),
1419 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p2, false, "", args(1,3, batarg("",date),batarg("value",date),arg("months",int))),
1420 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk, false, "", args(1,5, batarg("",date),batarg("value",date),batarg("months",int),batarg("s1",oid),batarg("s2",oid))),
1421 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p1, false, "", args(1,4, batarg("",date),arg("value",date),batarg("months",int),batarg("s",oid))),
1422 : pattern("batmtime", "addmonths", MTIMEdate_addmonths_bulk_p2, false, "", args(1,4, batarg("",date),batarg("value",date),arg("months",int),batarg("s",oid))),
1423 : command("mtime", "diff", MTIMEdate_diff, false, "returns the number of days\nbetween 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",date))),
1424 : pattern("batmtime", "diff", MTIMEdate_diff_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",date))),
1425 : pattern("batmtime", "diff", MTIMEdate_diff_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",date))),
1426 : pattern("batmtime", "diff", MTIMEdate_diff_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",date))),
1427 : pattern("batmtime", "diff", MTIMEdate_diff_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",date),batarg("val2",date),batarg("s1",oid),batarg("s2",oid))),
1428 : pattern("batmtime", "diff", MTIMEdate_diff_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",date),batarg("val2",date),batarg("s",oid))),
1429 : pattern("batmtime", "diff", MTIMEdate_diff_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",date),arg("val2",date),batarg("s",oid))),
1430 : command("mtime", "dayofyear", MTIMEdate_extract_dayofyear, false, "Returns N where d is the Nth day\nof the year (january 1 returns 1)", args(1,2, arg("",sht),arg("d",date))),
1431 : pattern("batmtime", "dayofyear", MTIMEdate_extract_dayofyear_bulk, false, "", args(1,2, batarg("",sht),batarg("d",date))),
1432 : pattern("batmtime", "dayofyear", MTIMEdate_extract_dayofyear_bulk, false, "", args(1,3, batarg("",sht),batarg("d",date),batarg("s",oid))),
1433 : command("mtime", "weekofyear", MTIMEdate_extract_weekofyear, false, "Returns the week number in the year.", args(1,2, arg("",bte),arg("d",date))),
1434 : pattern("batmtime", "weekofyear", MTIMEdate_extract_weekofyear_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1435 : pattern("batmtime", "weekofyear", MTIMEdate_extract_weekofyear_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1436 : command("mtime", "usweekofyear", MTIMEdate_extract_usweekofyear, false, "Returns the week number in the year, US style.", args(1,2, arg("",bte),arg("d",date))),
1437 : pattern("batmtime", "usweekofyear", MTIMEdate_extract_usweekofyear_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1438 : pattern("batmtime", "usweekofyear", MTIMEdate_extract_usweekofyear_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1439 : command("mtime", "dayofweek", MTIMEdate_extract_dayofweek, false, "Returns the current day of the week\nwhere 1=monday, .., 7=sunday", args(1,2, arg("",bte),arg("d",date))),
1440 : pattern("batmtime", "dayofweek", MTIMEdate_extract_dayofweek_bulk, false, "", args(1,2, batarg("",bte),batarg("d",date))),
1441 : pattern("batmtime", "dayofweek", MTIMEdate_extract_dayofweek_bulk, false, "", args(1,3, batarg("",bte),batarg("d",date),batarg("s",oid))),
1442 : command("mtime", "diff", MTIMEtimestamp_diff_msec, false, "returns the number of milliseconds\nbetween 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))),
1443 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))),
1444 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))),
1445 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))),
1446 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1447 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1448 : pattern("batmtime", "diff", MTIMEtimestamp_diff_msec_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1449 : command("mtime", "str_to_date", MTIMEstr_to_date, false, "create a date from the string, using the specified format (see man strptime)", args(1,3, arg("",date),arg("s",str),arg("format",str))),
1450 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk, false, "", args(1,3, batarg("",date),batarg("s",str),batarg("format",str))),
1451 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p1, false, "", args(1,3, batarg("",date),arg("s",str),batarg("format",str))),
1452 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p2, false, "", args(1,3, batarg("",date),batarg("s",str),arg("format",str))),
1453 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk, false, "", args(1,5, batarg("",date),batarg("s",str),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1454 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p1, false, "", args(1,4, batarg("",date),arg("s",str),batarg("format",str),batarg("s",oid))),
1455 : pattern("batmtime", "str_to_date", MTIMEstr_to_date_bulk_p2, false, "", args(1,4, batarg("",date),batarg("s",str),arg("format",str),batarg("s",oid))),
1456 : command("mtime", "date_to_str", MTIMEdate_to_str, false, "create a string from the date, using the specified format (see man strftime)", args(1,3, arg("",str),arg("d",date),arg("format",str))),
1457 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk, false, "", args(1,3, batarg("",str),batarg("d",date),batarg("format",str))),
1458 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk_p1, false, "", args(1,3, batarg("",str),arg("d",date),batarg("format",str))),
1459 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk_p2, false, "", args(1,3, batarg("",str),batarg("d",date),arg("format",str))),
1460 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk, false, "", args(1,5, batarg("",str),batarg("d",date),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1461 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk_p1, false, "", args(1,4, batarg("",str),arg("d",date),batarg("format",str),batarg("s",oid))),
1462 : pattern("batmtime", "date_to_str", MTIMEdate_to_str_bulk_p2, false, "", args(1,4, batarg("",str),batarg("d",date),arg("format",str),batarg("s",oid))),
1463 : command("mtime", "str_to_time", MTIMEstr_to_time, false, "create a time from the string, using the specified format (see man strptime)", args(1,3, arg("",daytime),arg("s",str),arg("format",str))),
1464 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk, false, "", args(1,3, batarg("",daytime),batarg("s",str),batarg("format",str))),
1465 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p1, false, "", args(1,3, batarg("",daytime),arg("s",str),batarg("format",str))),
1466 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p2, false, "", args(1,3, batarg("",daytime),batarg("s",str),arg("format",str))),
1467 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk, false, "", args(1,5, batarg("",daytime),batarg("s",str),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1468 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p1, false, "", args(1,4, batarg("",daytime),arg("s",str),batarg("format",str),batarg("s",oid))),
1469 : pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p2, false, "", args(1,4, batarg("",daytime),batarg("s",str),arg("format",str),batarg("s",oid))),
1470 : command("mtime", "time_to_str", MTIMEtime_to_str, false, "create a string from the time, using the specified format (see man strftime)", args(1,3, arg("",str),arg("d",daytime),arg("format",str))),
1471 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk, false, "", args(1,3, batarg("",str),batarg("d",daytime),batarg("format",str))),
1472 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p1, false, "", args(1,3, batarg("",str),arg("d",daytime),batarg("format",str))),
1473 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p2, false, "", args(1,3, batarg("",str),batarg("d",daytime),arg("format",str))),
1474 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk, false, "", args(1,5, batarg("",str),batarg("d",daytime),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1475 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p1, false, "", args(1,4, batarg("",str),arg("d",daytime),batarg("format",str),batarg("s",oid))),
1476 : pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p2, false, "", args(1,4, batarg("",str),batarg("d",daytime),arg("format",str),batarg("s",oid))),
1477 : command("mtime", "str_to_timestamp", MTIMEstr_to_timestamp, false, "create a timestamp from the string, using the specified format (see man strptime)", args(1,3, arg("",timestamp),arg("s",str),arg("format",str))),
1478 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk, false, "", args(1,3, batarg("",timestamp),batarg("d",str),batarg("format",str))),
1479 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk_p1, false, "", args(1,3, batarg("",timestamp),arg("s",str),batarg("format",str))),
1480 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk_p2, false, "", args(1,3, batarg("",timestamp),batarg("s",str),arg("format",str))),
1481 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk, false, "", args(1,5, batarg("",timestamp),batarg("d",str),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1482 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk_p1, false, "", args(1,4, batarg("",timestamp),arg("s",str),batarg("format",str),batarg("s",oid))),
1483 : pattern("batmtime", "str_to_timestamp", MTIMEstr_to_timestamp_bulk_p2, false, "", args(1,4, batarg("",timestamp),batarg("s",str),arg("format",str),batarg("s",oid))),
1484 : command("mtime", "timestamp_to_str", MTIMEtimestamp_to_str, false, "create a string from the time, using the specified format (see man strftime)", args(1,3, arg("",str),arg("d",timestamp),arg("format",str))),
1485 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk, false, "", args(1,3, batarg("",str),batarg("d",timestamp),batarg("format",str))),
1486 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk_p1, false, "", args(1,3, batarg("",str),arg("d",timestamp),batarg("format",str))),
1487 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk_p2, false, "", args(1,3, batarg("",str),batarg("d",timestamp),arg("format",str))),
1488 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk, false, "", args(1,5, batarg("",str),batarg("d",timestamp),batarg("format",str),batarg("s1",oid),batarg("s2",oid))),
1489 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk_p1, false, "", args(1,4, batarg("",str),arg("d",timestamp),batarg("format",str),batarg("s",oid))),
1490 : pattern("batmtime", "timestamp_to_str", MTIMEtimestamp_to_str_bulk_p2, false, "", args(1,4, batarg("",str),batarg("d",timestamp),arg("format",str),batarg("s",oid))),
1491 : command("mtime", "current_timestamp", MTIMEcurrent_timestamp, false, "", args(1,1, arg("",timestamp))),
1492 : command("mtime", "current_date", MTIMEcurrent_date, false, "", args(1,1, arg("",date))),
1493 : command("mtime", "current_time", MTIMEcurrent_time, false, "", args(1,1, arg("",daytime))),
1494 : command("mtime", "century", MTIMEtimestamp_century, false, "", args(1,2, arg("",int),arg("t",timestamp))),
1495 : pattern("batmtime", "century", MTIMEtimestamp_century_bulk, false, "", args(1,2, batarg("",int),batarg("t",timestamp))),
1496 : pattern("batmtime", "century", MTIMEtimestamp_century_bulk, false, "", args(1,3, batarg("",int),batarg("t",timestamp),batarg("s",oid))),
1497 : command("mtime", "decade", MTIMEtimestamp_decade, false, "", args(1,2, arg("",int),arg("t",timestamp))),
1498 : pattern("batmtime", "decade", MTIMEtimestamp_decade_bulk, false, "", args(1,2, batarg("",int),batarg("t",timestamp))),
1499 : pattern("batmtime", "decade", MTIMEtimestamp_decade_bulk, false, "", args(1,3, batarg("",int),batarg("t",timestamp),batarg("s",oid))),
1500 : command("mtime", "year", MTIMEtimestamp_year, false, "", args(1,2, arg("",int),arg("t",timestamp))),
1501 : pattern("batmtime", "year", MTIMEtimestamp_year_bulk, false, "", args(1,2, batarg("",int),batarg("t",timestamp))),
1502 : pattern("batmtime", "year", MTIMEtimestamp_year_bulk, false, "", args(1,3, batarg("",int),batarg("t",timestamp),batarg("s",oid))),
1503 : command("mtime", "quarter", MTIMEtimestamp_quarter, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1504 : pattern("batmtime", "quarter", MTIMEtimestamp_quarter_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1505 : pattern("batmtime", "quarter", MTIMEtimestamp_quarter_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1506 : command("mtime", "month", MTIMEtimestamp_month, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1507 : pattern("batmtime", "month", MTIMEtimestamp_month_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1508 : pattern("batmtime", "month", MTIMEtimestamp_month_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1509 : command("mtime", "day", MTIMEtimestamp_day, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1510 : pattern("batmtime", "day", MTIMEtimestamp_day_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1511 : pattern("batmtime", "day", MTIMEtimestamp_day_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1512 : command("mtime", "hours", MTIMEtimestamp_hours, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1513 : pattern("batmtime", "hours", MTIMEtimestamp_hours_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1514 : pattern("batmtime", "hours", MTIMEtimestamp_hours_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1515 : command("mtime", "minutes", MTIMEtimestamp_minutes, false, "", args(1,2, arg("",bte),arg("t",timestamp))),
1516 : pattern("batmtime", "minutes", MTIMEtimestamp_minutes_bulk, false, "", args(1,2, batarg("",bte),batarg("t",timestamp))),
1517 : pattern("batmtime", "minutes", MTIMEtimestamp_minutes_bulk, false, "", args(1,3, batarg("",bte),batarg("t",timestamp),batarg("s",oid))),
1518 : command("mtime", "sql_seconds", MTIMEtimestamp_sql_seconds, false, "", args(1,2, arg("",int),arg("t",timestamp))),
1519 : pattern("batmtime", "sql_seconds", MTIMEtimestamp_sql_seconds_bulk, false, "", args(1,2, batarg("",int),batarg("d",timestamp))),
1520 : pattern("batmtime", "sql_seconds", MTIMEtimestamp_sql_seconds_bulk, false, "", args(1,3, batarg("",int),batarg("d",timestamp),batarg("s",oid))),
1521 : command("mtime", "epoch_ms", MTIMEtimestamp_extract_epoch_ms, false, "", args(1,2, arg("",lng),arg("t",timestamp))),
1522 : pattern("batmtime", "epoch_ms", MTIMEtimestamp_extract_epoch_ms_bulk, false, "", args(1,2, batarg("",lng),batarg("t",timestamp))),
1523 : pattern("batmtime", "epoch_ms", MTIMEtimestamp_extract_epoch_ms_bulk, false, "", args(1,3, batarg("",lng),batarg("t",timestamp),batarg("s",oid))),
1524 : command("mtime", "year", MTIMEsql_year, false, "", args(1,2, arg("",int),arg("months",int))),
1525 : pattern("batmtime", "year", MTIMEsql_year_bulk, false, "", args(1,2, batarg("",int),batarg("months",int))),
1526 : pattern("batmtime", "year", MTIMEsql_year_bulk, false, "", args(1,3, batarg("",int),batarg("months",int),batarg("s",oid))),
1527 : command("mtime", "month", MTIMEsql_month, false, "", args(1,2, arg("",int),arg("months",int))),
1528 : pattern("batmtime", "month", MTIMEsql_month_bulk, false, "", args(1,2, batarg("",int),batarg("months",int))),
1529 : pattern("batmtime", "month", MTIMEsql_month_bulk, false, "", args(1,3, batarg("",int),batarg("months",int),batarg("s",oid))),
1530 : command("mtime", "day", MTIMEsql_day, false, "", args(1,2, arg("",lng),arg("msecs",lng))),
1531 : pattern("batmtime", "day", MTIMEsql_day_bulk, false, "", args(1,2, batarg("",lng),batarg("msecs",lng))),
1532 : pattern("batmtime", "day", MTIMEsql_day_bulk, false, "", args(1,3, batarg("",lng),batarg("msecs",lng),batarg("s",oid))),
1533 : command("mtime", "hours", MTIMEsql_hours, false, "", args(1,2, arg("",int),arg("msecs",lng))),
1534 : pattern("batmtime", "hours", MTIMEsql_hours_bulk, false, "", args(1,2, batarg("",int),batarg("msecs",lng))),
1535 : pattern("batmtime", "hours", MTIMEsql_hours_bulk, false, "", args(1,3, batarg("",int),batarg("msecs",lng),batarg("s",oid))),
1536 : command("mtime", "minutes", MTIMEsql_minutes, false, "", args(1,2, arg("",int),arg("msecs",lng))),
1537 : pattern("batmtime", "minutes", MTIMEsql_minutes_bulk, false, "", args(1,2, batarg("",int),batarg("msecs",lng))),
1538 : pattern("batmtime", "minutes", MTIMEsql_minutes_bulk, false, "", args(1,3, batarg("",int),batarg("msecs",lng),batarg("s",oid))),
1539 : command("mtime", "seconds", MTIMEsql_seconds, false, "", args(1,2, arg("",int),arg("msecs",lng))),
1540 : pattern("batmtime", "seconds", MTIMEsql_seconds_bulk, false, "", args(1,2, batarg("",int),batarg("msecs",lng))),
1541 : pattern("batmtime", "seconds", MTIMEsql_seconds_bulk, false, "", args(1,3, batarg("",int),batarg("msecs",lng),batarg("s",oid))),
1542 : command("mtime", "epoch_ms", MTIMEmsec_extract_epoch_ms, false, "", args(1,2, arg("",lng),arg("msecs",lng))),
1543 : pattern("batmtime", "epoch_ms", MTIMEmsec_extract_epoch_ms_bulk, false, "", args(1,2, batarg("",lng),batarg("msecs",lng))),
1544 : pattern("batmtime", "epoch_ms", MTIMEmsec_extract_epoch_ms_bulk, false, "", args(1,3, batarg("",lng),batarg("msecs",lng),batarg("s",oid))),
1545 : command("calc", "date", MTIMEdate_fromstr, false, "", args(1,2, arg("",date),arg("s",str))),
1546 : command("calc", "date", MTIMEdate_date, false, "", args(1,2, arg("",date),arg("d",date))),
1547 : command("calc", "date", MTIMEtimestamp_extract_date, false, "", args(1,2, arg("",date),arg("t",timestamp))),
1548 : command("calc", "timestamp", MTIMEtimestamp_fromstr, false, "", args(1,2, arg("",timestamp),arg("s",str))),
1549 : command("calc", "timestamp", MTIMEtimestamp_timestamp, false, "", args(1,2, arg("",timestamp),arg("t",timestamp))),
1550 : command("calc", "timestamp", MTIMEtimestamp_fromdate, false, "", args(1,2, arg("",timestamp),arg("d",date))),
1551 : command("calc", "timestamp", MTIMEtimestamp_fromsecond, false, "", args(1,2, arg("",timestamp),arg("secs",int))),
1552 : command("calc", "timestamp", MTIMEtimestamp_frommsec, false, "", args(1,2, arg("",timestamp),arg("msecs",lng))),
1553 : command("calc", "daytime", MTIMEdaytime_fromstr, false, "", args(1,2, arg("",daytime),arg("s",str))),
1554 : command("calc", "daytime", MTIMEdaytime_daytime, false, "", args(1,2, arg("",daytime),arg("d",daytime))),
1555 : command("calc", "daytime", MTIMEdaytime_fromseconds, false, "", args(1,2, arg("",daytime),arg("s",lng))),
1556 : command("calc", "daytime", MTIMEtimestamp_extract_daytime, false, "", args(1,2, arg("",daytime),arg("t",timestamp))),
1557 : // pattern("batcalc", "date", MTIMEdate_fromstr_bulk, false, "", args(1,2, batarg("",date),batarg("s",str))),
1558 : pattern("batcalc", "date", MTIMEdate_fromstr_bulk, false, "", args(1,3, batarg("",date),batarg("s",str),batarg("s",oid))),
1559 : // pattern("batcalc", "date", MTIMEdate_date_bulk, false, "", args(1,2, batarg("",date),batarg("d",date))),
1560 : pattern("batcalc", "date", MTIMEdate_date_bulk, false, "", args(1,3, batarg("",date),batarg("d",date),batarg("s",oid))),
1561 : // pattern("batcalc", "date", MTIMEtimestamp_extract_date_bulk, false, "", args(1,2, batarg("",date),batarg("t",timestamp))),
1562 : pattern("batcalc", "date", MTIMEtimestamp_extract_date_bulk, false, "", args(1,3, batarg("",date),batarg("t",timestamp),batarg("s",oid))),
1563 : // pattern("batcalc", "timestamp", MTIMEtimestamp_fromstr_bulk, false, "", args(1,2, batarg("",timestamp),batarg("s",str))),
1564 : pattern("batcalc", "timestamp", MTIMEtimestamp_fromstr_bulk, false, "", args(1,3, batarg("",timestamp),batarg("s",str),batarg("s",oid))),
1565 : // pattern("batcalc", "timestamp", MTIMEtimestamp_timestamp_bulk, false, "", args(1,2, batarg("",timestamp),batarg("t",timestamp))),
1566 : pattern("batcalc", "timestamp", MTIMEtimestamp_timestamp_bulk, false, "", args(1,3, batarg("",timestamp),batarg("t",timestamp),batarg("s",oid))),
1567 : // pattern("batcalc", "timestamp", MTIMEtimestamp_fromdate_bulk, false, "", args(1,2, batarg("",timestamp),batarg("d",date))),
1568 : pattern("batcalc", "timestamp", MTIMEtimestamp_fromdate_bulk, false, "", args(1,3, batarg("",timestamp),batarg("d",date),batarg("s",oid))),
1569 : // pattern("batcalc", "timestamp", MTIMEtimestamp_fromsecond_bulk, false, "", args(1,2, batarg("",timestamp),batarg("secs",int))),
1570 : pattern("batcalc", "timestamp", MTIMEtimestamp_fromsecond_bulk, false, "", args(1,3, batarg("",timestamp),batarg("secs",int),batarg("s",oid))),
1571 : // pattern("batcalc", "timestamp", MTIMEtimestamp_frommsec_bulk, false, "", args(1,2, batarg("",timestamp),batarg("msecs",lng))),
1572 : pattern("batcalc", "timestamp", MTIMEtimestamp_frommsec_bulk, false, "", args(1,3, batarg("",timestamp),batarg("msecs",lng),batarg("s",oid))),
1573 : // pattern("batcalc", "daytime", MTIMEdaytime_fromstr_bulk, false, "", args(1,2, batarg("",daytime),batarg("s",str))),
1574 : pattern("batcalc", "daytime", MTIMEdaytime_fromstr_bulk, false, "", args(1,3, batarg("",daytime),batarg("s",str),batarg("s",oid))),
1575 : // pattern("batcalc", "daytime", MTIMEdaytime_daytime_bulk, false, "", args(1,2, batarg("",daytime),batarg("d",daytime))),
1576 : pattern("batcalc", "daytime", MTIMEdaytime_daytime_bulk, false, "", args(1,3, batarg("",daytime),batarg("d",daytime),batarg("s",oid))),
1577 : // pattern("batcalc", "daytime", MTIMEdaytime_fromseconds_bulk, false, "", args(1,2, batarg("",daytime),batarg("s",lng))),
1578 : pattern("batcalc", "daytime", MTIMEdaytime_fromseconds_bulk, false, "", args(1,3, batarg("",daytime),batarg("s",lng),batarg("s",oid))),
1579 : // pattern("batcalc", "daytime", MTIMEtimestamp_extract_daytime_bulk, false, "", args(1,2, batarg("",daytime),batarg("t",timestamp))),
1580 : pattern("batcalc", "daytime", MTIMEtimestamp_extract_daytime_bulk, false, "", args(1,3, batarg("",daytime),batarg("t",timestamp),batarg("s",oid))),
1581 : // -- odbc timestampdiff variants
1582 : command("mtime", "timestampdiff_sec", MTIMEtimestampdiff_sec, false, "diff in seconds between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))),
1583 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))),
1584 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))),
1585 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))),
1586 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1587 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1588 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1589 : // --
1590 : command("mtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts, false, "diff in seconds between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",timestamp))),
1591 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",timestamp))),
1592 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",timestamp))),
1593 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",timestamp))),
1594 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",date),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1595 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",date),batarg("val2",timestamp),batarg("s",oid))),
1596 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_d_ts_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",date),arg("val2",timestamp),batarg("s",oid))),
1597 : // --
1598 : command("mtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d, false, "diff in seconds between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",date))),
1599 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",date))),
1600 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",date))),
1601 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",date))),
1602 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",date),batarg("s1",oid),batarg("s2",oid))),
1603 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",date),batarg("s",oid))),
1604 : pattern("batmtime", "timestampdiff_sec", MTIMEtimestampdiff_sec_ts_d_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",date),batarg("s",oid))),
1605 : // --
1606 : command("mtime", "timestampdiff_min", MTIMEtimestampdiff_min, false, "diff in min between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))),
1607 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))),
1608 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))),
1609 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))),
1610 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1611 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1612 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1613 : // --
1614 : command("mtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts, false, "diff in min between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",timestamp))),
1615 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",timestamp))),
1616 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",timestamp))),
1617 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",timestamp))),
1618 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",date),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1619 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",date),batarg("val2",timestamp),batarg("s",oid))),
1620 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_d_ts_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",date),arg("val2",timestamp),batarg("s",oid))),
1621 : // --
1622 : command("mtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d, false, "diff in min between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",date))),
1623 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",date))),
1624 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",date))),
1625 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",date))),
1626 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",date),batarg("s1",oid),batarg("s2",oid))),
1627 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",date),batarg("s",oid))),
1628 : pattern("batmtime", "timestampdiff_min", MTIMEtimestampdiff_min_ts_d_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",date),batarg("s",oid))),
1629 : // --
1630 : command("mtime", "timestampdiff_hour", MTIMEtimestampdiff_hour, false, "diff in hours between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",timestamp))),
1631 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp))),
1632 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp))),
1633 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp))),
1634 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1635 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1636 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1637 : // --
1638 : command("mtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts, false, "diff in hours between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",date),arg("val2",timestamp))),
1639 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",date),batarg("val2",timestamp))),
1640 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",date),batarg("val2",timestamp))),
1641 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",date),arg("val2",timestamp))),
1642 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",date),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1643 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",date),batarg("val2",timestamp),batarg("s",oid))),
1644 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_d_ts_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",date),arg("val2",timestamp),batarg("s",oid))),
1645 : // --
1646 : command("mtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d, false, "diff in hours between 'val1' and 'val2'.", args(1,3, arg("",lng),arg("val1",timestamp),arg("val2",date))),
1647 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),batarg("val2",date))),
1648 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk_p1, false, "", args(1,3, batarg("",lng),arg("val1",timestamp),batarg("val2",date))),
1649 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk_p2, false, "", args(1,3, batarg("",lng),batarg("val1",timestamp),arg("val2",date))),
1650 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk, false, "", args(1,5, batarg("",lng),batarg("val1",timestamp),batarg("val2",date),batarg("s1",oid),batarg("s2",oid))),
1651 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk_p1, false, "", args(1,4, batarg("",lng),arg("val1",timestamp),batarg("val2",date),batarg("s",oid))),
1652 : pattern("batmtime", "timestampdiff_hour", MTIMEtimestampdiff_hour_ts_d_bulk_p2, false, "", args(1,4, batarg("",lng),batarg("val1",timestamp),arg("val2",date),batarg("s",oid))),
1653 : // --
1654 : command("mtime", "timestampdiff_day", MTIMEtimestampdiff_day, false, "diff in days between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
1655 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
1656 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
1657 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
1658 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1659 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1660 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1661 : // --
1662 : command("mtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts, false, "diff in days between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
1663 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
1664 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
1665 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
1666 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1667 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
1668 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
1669 : // --
1670 : command("mtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t, false, "diff in days between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
1671 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
1672 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
1673 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
1674 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
1675 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
1676 : pattern("batmtime", "timestampdiff_day", MTIMEtimestampdiff_day_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
1677 : // --
1678 : command("mtime", "timestampdiff_week", MTIMEtimestampdiff_week, false, "diff in weeks between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
1679 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
1680 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
1681 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
1682 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1683 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1684 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1685 : // --
1686 : command("mtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts, false, "diff in weeks between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
1687 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
1688 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
1689 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
1690 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1691 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
1692 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
1693 : // --
1694 : command("mtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t, false, "diff in weeks between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
1695 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
1696 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
1697 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
1698 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
1699 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
1700 : pattern("batmtime", "timestampdiff_week", MTIMEtimestampdiff_week_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
1701 : // --
1702 : command("mtime", "timestampdiff_month", MTIMEtimestampdiff_month, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
1703 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
1704 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
1705 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
1706 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1707 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1708 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1709 : // --
1710 : command("mtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
1711 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
1712 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
1713 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
1714 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1715 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
1716 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
1717 : // --
1718 : command("mtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
1719 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
1720 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
1721 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
1722 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
1723 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
1724 : pattern("batmtime", "timestampdiff_month", MTIMEtimestampdiff_month_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
1725 : // --
1726 : command("mtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
1727 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
1728 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
1729 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
1730 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1731 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1732 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1733 : // --
1734 : command("mtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
1735 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
1736 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
1737 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
1738 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1739 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
1740 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
1741 : // --
1742 : command("mtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
1743 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
1744 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
1745 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
1746 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
1747 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
1748 : pattern("batmtime", "timestampdiff_quarter", MTIMEtimestampdiff_quarter_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
1749 : // --
1750 : command("mtime", "timestampdiff_year", MTIMEtimestampdiff_year, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",timestamp))),
1751 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp))),
1752 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp))),
1753 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp))),
1754 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1755 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",timestamp),batarg("s",oid))),
1756 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",timestamp),batarg("s",oid))),
1757 : // --
1758 : command("mtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",daytime),arg("val2",timestamp))),
1759 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk, false, "", args(1,3, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp))),
1760 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",daytime),batarg("val2",timestamp))),
1761 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",daytime),arg("val2",timestamp))),
1762 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk, false, "", args(1,5, batarg("",int),batarg("val1",daytime),batarg("val2",timestamp),batarg("s1",oid),batarg("s2",oid))),
1763 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",daytime),batarg("val2",timestamp),batarg("s",oid))),
1764 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_t_ts_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",daytime),arg("val2",timestamp),batarg("s",oid))),
1765 : // --
1766 : command("mtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t, false, "diff in months between 'val1' and 'val2'.", args(1,3, arg("",int),arg("val1",timestamp),arg("val2",daytime))),
1767 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime))),
1768 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk_p1, false, "", args(1,3, batarg("",int),arg("val1",timestamp),batarg("val2",daytime))),
1769 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk_p2, false, "", args(1,3, batarg("",int),batarg("val1",timestamp),arg("val2",daytime))),
1770 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk, false, "", args(1,5, batarg("",int),batarg("val1",timestamp),batarg("val2",daytime),batarg("s1",oid),batarg("s2",oid))),
1771 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk_p1, false, "", args(1,4, batarg("",int),arg("val1",timestamp),batarg("val2",daytime),batarg("s",oid))),
1772 : pattern("batmtime", "timestampdiff_year", MTIMEtimestampdiff_year_ts_t_bulk_p2, false, "", args(1,4, batarg("",int),batarg("val1",timestamp),arg("val2",daytime),batarg("s",oid))),
1773 : { .imp=NULL }
1774 : };
1775 : #include "mal_import.h"
1776 : #ifdef _MSC_VER
1777 : #undef read
1778 : #pragma section(".CRT$XCU",read)
1779 : #endif
1780 329 : LIB_STARTUP_FUNC(init_mtime_mal)
1781 329 : { mal_module("mtime", NULL, mtime_init_funcs); }
|