dbms: fixed error with formatting DateTime near begin of unix epoch; fixed error with toTime function when changing daylight saving time; fixed toTime function for non-Moscow time zones [#CONV-7755].

This commit is contained in:
Alexey Milovidov 2013-06-01 04:58:52 +00:00
parent 2698537c59
commit 3673752d1b
2 changed files with 3 additions and 1 deletions

View File

@ -119,7 +119,7 @@ struct ToStartOfYearImpl
struct ToTimeImpl struct ToTimeImpl
{ {
/// При переводе во время, дату будем приравнивать к 1970-01-02. /// При переводе во время, дату будем приравнивать к 1970-01-02.
static inline UInt32 execute(UInt32 t, Yandex::DateLUTSingleton & date_lut) { return t - date_lut.toDate(t) + 75600; } static inline UInt32 execute(UInt32 t, Yandex::DateLUTSingleton & date_lut) { return date_lut.toTimeInaccurate(t) + 86400; }
static inline UInt32 execute(UInt16 d, Yandex::DateLUTSingleton & date_lut) static inline UInt32 execute(UInt16 d, Yandex::DateLUTSingleton & date_lut)
{ {
throw Exception("Illegal type Date of argument for function toTime", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); throw Exception("Illegal type Date of argument for function toTime", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);

View File

@ -40,5 +40,7 @@ namespace Yandex
if (lut[day].month == 1 && lut[day].day_of_month == 1) if (lut[day].month == 1 && lut[day].day_of_month == 1)
years_lut[lut[day].year - DATE_LUT_MIN_YEAR] = day; years_lut[lut[day].year - DATE_LUT_MIN_YEAR] = day;
} }
offset_at_start_of_epoch = 86400 - lut[findIndex(86400)].date;
} }
} }