From b099ce524c650ab811741b556c51f635b4a61ef1 Mon Sep 17 00:00:00 2001 From: Dominik Richter Date: Sun, 17 Sep 2023 23:52:19 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=9F=A2=20use=20time=20tied=20to=20local?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit moving to UTC has a ton of advantages (eg because we do not store locations for time, only unix timestamps), but it comes with a lot of pitfalls (like printing it correctly). Drop UTC in favor of Local time Signed-off-by: Dominik Richter --- llx/primitives.go | 4 ++-- llx/rawdata.go | 2 +- llx/rawdata_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llx/primitives.go b/llx/primitives.go index 6ec3a6e875..ea27db36d7 100644 --- a/llx/primitives.go +++ b/llx/primitives.go @@ -93,10 +93,10 @@ func TimePrimitive(t *time.Time) *Primitive { } // NeverFutureTime is an indicator for what we consider infinity when looking at time -var NeverFutureTime = time.Unix(1<<63-1, 0).UTC() +var NeverFutureTime = time.Unix(1<<63-1, 0) // NeverPastTime is an indicator for what we consider negative infinity when looking at time -var NeverPastTime = time.Unix(-(1<<63 - 1), 0).UTC() +var NeverPastTime = time.Unix(-(1<<63 - 1), 0) // NeverFuturePrimitive is the special time primitive for the infinite future time var NeverFuturePrimitive = TimePrimitive(&NeverFutureTime) diff --git a/llx/rawdata.go b/llx/rawdata.go index 61fede63b4..c19dbeb2f0 100644 --- a/llx/rawdata.go +++ b/llx/rawdata.go @@ -58,7 +58,7 @@ func (r *RawData) UnmarshalJSON(data []byte) error { } else if tv < (-(1 << 53)) { r.Value = &NeverPastTime } else { - v := time.Unix(int64(tv), 0).UTC() + v := time.Unix(int64(tv), 0) r.Value = &v } } diff --git a/llx/rawdata_test.go b/llx/rawdata_test.go index 8a770c609e..4bee540e2c 100644 --- a/llx/rawdata_test.go +++ b/llx/rawdata_test.go @@ -189,7 +189,7 @@ func TestRawData_JSON(t *testing.T) { StringData("b"), RegexData(""), RegexData("r"), - TimeData(time.Time{}), + TimeData(time.Time{}.In(time.Local)), TimeData(NeverFutureTime), TimeData(NeverPastTime), // TODO: the raw comparison here does not come out right, because of nano time