dbms: fixed error with formatting of date-times with 1970-01-01 dates [#METR-11873].

This commit is contained in:
Alexey Milovidov 2014-07-10 22:53:09 +04:00
parent c60096564a
commit 4c7226627c
3 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1 @@
1970-01-01 14:25:36

View File

@ -0,0 +1 @@
SELECT toString(toDateTime('1970-01-01 14:25:36'))

View File

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