ClickHouse/base/common/tests/date_lut4.cpp
2020-03-18 19:51:20 +03:00

21 lines
616 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <iostream>
#include <common/DateLUT.h>
int main(int, char **)
{
/** В DateLUT был глюк - для времён из дня 1970-01-01, возвращался номер часа больше 23. */
static const time_t TIME = 66130;
const auto & date_lut = DateLUT::instance();
std::cerr << date_lut.toHour(TIME) << std::endl;
std::cerr << date_lut.toDayNum(TIME) << std::endl;
const auto * values = reinterpret_cast<const DateLUTImpl::Values *>(&date_lut);
std::cerr << values[0].date << ", " << time_t(values[1].date - values[0].date) << std::endl;
return 0;
}