diff --git a/llx/builtin_simple.go b/llx/builtin_simple.go index ee50e0e867..303e1e924a 100644 --- a/llx/builtin_simple.go +++ b/llx/builtin_simple.go @@ -928,7 +928,7 @@ func timePlusTimeV2(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) ( return TimeData(DurationToTime(sum)) } - return TimeData(time.Unix(sum, 0)) + return TimeData(time.Unix(sum, 0).UTC()) }) } @@ -2288,7 +2288,7 @@ func TimeToDuration(t *time.Time) int64 { // DurationToTime takes a duration in seconds and turns it into a time object func DurationToTime(i int64) time.Time { - return time.Unix(i+zeroTimeOffset, 0) + return time.Unix(i+zeroTimeOffset, 0).UTC() } func timeSecondsV2(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) { diff --git a/llx/byte_conversions.go b/llx/byte_conversions.go index 127f7b65c6..bcba9b61f2 100644 --- a/llx/byte_conversions.go +++ b/llx/byte_conversions.go @@ -50,5 +50,5 @@ func bytes2float(b []byte) float64 { func bytes2time(b []byte) time.Time { secs := int64(binary.LittleEndian.Uint64(b[0:8])) nanos := int64(binary.LittleEndian.Uint32(b[8:])) - return time.Unix(secs, nanos) + return time.Unix(secs, nanos).UTC() } diff --git a/providers/core/resources/time.go b/providers/core/resources/time.go index adb760b3f8..e77824e94f 100644 --- a/providers/core/resources/time.go +++ b/providers/core/resources/time.go @@ -39,9 +39,8 @@ func (x *mqlTime) day() (*time.Time, error) { } func (x *mqlTime) today() (*time.Time, error) { - now := time.Now() + now := time.Now().UTC() today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) - return &today, nil } diff --git a/providers/core/resources/time_test.go b/providers/core/resources/time_test.go index 193e2aa2b1..c8cba6724f 100644 --- a/providers/core/resources/time_test.go +++ b/providers/core/resources/time_test.go @@ -127,9 +127,10 @@ func TestTimeParsing(t *testing.T) { } func TestTime_Methods(t *testing.T) { - now := time.Now() + now := time.Now().UTC() today, _ := time.ParseInLocation("2006-01-02", now.Format("2006-01-02"), now.Location()) - tomorrow := today.Add(24 * time.Hour) + today = today.UTC() + tomorrow := today.Add(24 * time.Hour).UTC() x := testutils.InitTester(testutils.LinuxMock()) x.TestSimple(t, []testutils.SimpleTest{