Problem
utils/typeutil/typeutil.go contains two time conversion functions with several issues:
TimeEpoch (Chrome WebKit epoch → time.Time)
- Uses
time.Local instead of time.UTC — Chrome stores times in UTC, so results vary depending on the machine's timezone
- Uses a loop (
for i := 0; i < 1000; i++) to work around int64 overflow instead of proper epoch conversion
maxTime = 99633311740000000 is an unexplained magic number
- Overflow fallback returns
2049-01-01 01:01:01 with no explanation for this date
epoch = 0 returns 1601-01-01 instead of a zero value
TimeStamp (Unix timestamp → time.Time)
- Uses
s.Local().Year() mixing Local timezone into the check
- Overflow fallback returns
9999-12-13 23:59:59 — the December 13th date appears arbitrary
stamp = 0 returns 1970-01-01 instead of a zero value
Impact
- Time values displayed to users may be off by hours depending on timezone
- Unit tests that assert on specific time values will fail in different CI timezones
- Magic dates in fallback paths are confusing for maintainers
Problem
utils/typeutil/typeutil.gocontains two time conversion functions with several issues:TimeEpoch(Chrome WebKit epoch → time.Time)time.Localinstead oftime.UTC— Chrome stores times in UTC, so results vary depending on the machine's timezonefor i := 0; i < 1000; i++) to work around int64 overflow instead of proper epoch conversionmaxTime = 99633311740000000is an unexplained magic number2049-01-01 01:01:01with no explanation for this dateepoch = 0returns1601-01-01instead of a zero valueTimeStamp(Unix timestamp → time.Time)s.Local().Year()mixing Local timezone into the check9999-12-13 23:59:59— the December 13th date appears arbitrarystamp = 0returns1970-01-01instead of a zero valueImpact