Skip to content

Commit

Permalink
Functions for interval arithmetic on DateTime and Date: development […
Browse files Browse the repository at this point in the history
…#CLICKHOUSE-2].
  • Loading branch information
alexey-milovidov committed Oct 29, 2017
1 parent 5c8c3bd commit 9f4a3a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/libcommon/include/common/DateLUTImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DateLUTImpl
private:
/// Lookup table is indexed by DayNum.
/// Day nums are the same in all time zones. 1970-01-01 is 0 and so on.
/// Table is relatively large, so better not to place object on stack.
/// Table is relatively large, so better not to place the object on stack.
/// In comparison to std::vector, plain array is cheaper by one indirection.
Values lut[DATE_LUT_SIZE];

Expand Down Expand Up @@ -249,7 +249,7 @@ class DateLUTImpl
size_t index = findIndex(t);

if (unlikely(index == 0))
return t - offset_at_start_of_epoch;
return t + offset_at_start_of_epoch;

time_t res = t - lut[index].date;

Expand All @@ -264,7 +264,7 @@ class DateLUTImpl
size_t index = findIndex(t);

if (unlikely(index == 0))
return (t - offset_at_start_of_epoch) / 3600;
return (t + offset_at_start_of_epoch) / 3600;

time_t res = t - lut[index].date;

Expand Down

0 comments on commit 9f4a3a5

Please sign in to comment.