1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#pragma once
#include <stddef.h>
#include <time.h>
#include <Core/Types.h>
class DateLUTImpl;
namespace DB
{
class ReadBuffer;
/** https://xkcd.com/1179/
*
* The existence of this function is an example of bad practice
* and contradicts our development principles.
*
* This function will recognize the following patterns:
*
* NNNNNNNNNN - 9..10 digits is a unix timestamp
*
* YYYYMMDDhhmmss - 14 numbers is always interpreted this way
*
* YYYYMMDD - 8 digits in a row
* YYYY*MM*DD - or with any delimiter after first 4-digit year component and after month.
*
* DD/MM/YY
* DD/MM/YYYY - when '/' separator is used, these are the only possible forms
*
* hh:mm:ss - when ':' separator is used, it is always time
* hh:mm - it can be specified without seconds
*
* YYYY - 4 digits is always year
*
* YYYYMM - 6 digits is a year, month if year was not already read
* hhmmss - 6 digits is a time if year was already read
*
* .nnnnnnn - any number of digits after point is fractional part of second, if it is not YYYY.MM.DD or DD.MM.YYYY
*
* T - means that time will follow
*
* Z - means zero UTC offset
*
* +hhmm
* +hh:mm
* +hh
* -... - time zone offset
*
* single whitespace can be used as a separator
*
* AM/PM - AM means: subtract 12 hours if a value is 12 and PM means: add 12 hours if a value is less than 12.
*
* Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec - allowed to specify month
* Mon/Tue/Wed/Thu/Fri/Sat/Sun - simply ignored.
*/
void parseDateTimeBestEffort(time_t & res, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone);
bool tryParseDateTimeBestEffort(time_t & res, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone);
void parseDateTimeBestEffortUS(time_t & res, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone);
bool tryParseDateTimeBestEffortUS(time_t & res, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone);
void parseDateTime64BestEffort(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone);
bool tryParseDateTime64BestEffort(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone);
void parseDateTime64BestEffortUS(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone);
bool tryParseDateTime64BestEffortUS(DateTime64 & res, UInt32 scale, ReadBuffer & in, const DateLUTImpl & local_time_zone, const DateLUTImpl & utc_time_zone);
}
|