ClickHouse/dbms/IO/tests/parse_date_time_best_effort.cpp
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

33 lines
765 B
C++

#include <string>
#include <IO/parseDateTimeBestEffort.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <IO/ReadBufferFromFileDescriptor.h>
#include <IO/WriteBufferFromFileDescriptor.h>
using namespace DB;
int main(int, char **)
try
{
const DateLUTImpl & local_time_zone = DateLUT::instance();
const DateLUTImpl & utc_time_zone = DateLUT::instance("UTC");
ReadBufferFromFileDescriptor in(STDIN_FILENO);
WriteBufferFromFileDescriptor out(STDOUT_FILENO);
time_t res;
parseDateTimeBestEffort(res, in, local_time_zone, utc_time_zone);
writeDateTimeText(res, out);
writeChar('\n', out);
return 0;
}
catch (const Exception &)
{
std::cerr << getCurrentExceptionMessage(true) << std::endl;
return 1;
}