mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 07:01:59 +00:00
dbms: fixed error with formatting of date-times with 1970-01-01 dates [#METR-11873].
This commit is contained in:
parent
c60096564a
commit
4c7226627c
1
dbms/tests/queries/0_stateless/00060_date_lut.reference
Normal file
1
dbms/tests/queries/0_stateless/00060_date_lut.reference
Normal file
@ -0,0 +1 @@
|
||||
1970-01-01 14:25:36
|
1
dbms/tests/queries/0_stateless/00060_date_lut.sql
Normal file
1
dbms/tests/queries/0_stateless/00060_date_lut.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT toString(toDateTime('1970-01-01 14:25:36'))
|
20
libs/libcommon/src/tests/date_lut4.cpp
Normal file
20
libs/libcommon/src/tests/date_lut4.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user