Skip to content

Commit

Permalink
🟢 use time tied to local
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
arlimus committed Sep 18, 2023
1 parent 46cd566 commit b099ce5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions llx/primitives.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion llx/rawdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion llx/rawdata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b099ce5

Please sign in to comment.