1 | #include <string> |
---|---|
2 | |
3 | #include <IO/parseDateTimeBestEffort.h> |
4 | #include <IO/ReadHelpers.h> |
5 | #include <IO/WriteHelpers.h> |
6 | #include <IO/ReadBufferFromFileDescriptor.h> |
7 | #include <IO/WriteBufferFromFileDescriptor.h> |
8 | |
9 | |
10 | using namespace DB; |
11 | |
12 | int main(int, char **) |
13 | try |
14 | { |
15 | const DateLUTImpl & local_time_zone = DateLUT::instance(); |
16 | const DateLUTImpl & utc_time_zone = DateLUT::instance("UTC"); |
17 | |
18 | ReadBufferFromFileDescriptor in(STDIN_FILENO); |
19 | WriteBufferFromFileDescriptor out(STDOUT_FILENO); |
20 | |
21 | time_t res; |
22 | parseDateTimeBestEffort(res, in, local_time_zone, utc_time_zone); |
23 | writeDateTimeText(res, out); |
24 | writeChar('\n', out); |
25 | |
26 | return 0; |
27 | } |
28 | catch (const Exception &) |
29 | { |
30 | std::cerr << getCurrentExceptionMessage(true) << std::endl; |
31 | return 1; |
32 | } |
33 |