Compare commits

...

2 Commits

Author SHA1 Message Date
“Jayice”
c33d0a6c1d add fail case for parsing fractional ts
Signed-off-by: “Jayice” <jzhou@victoriametrics.com>
2026-07-29 19:23:12 +08:00
“Jayice”
c204470b89 add fail case for parsing fractional ts
Signed-off-by: “Jayice” <jzhou@victoriametrics.com>
2026-07-29 19:22:50 +08:00

View File

@@ -23,6 +23,22 @@ func TestTryParseUnixTimestamp_Success(t *testing.T) {
f("0", 0)
//smaller than maxValidSecond
f("12", 12000000000)
f("12.0", 12000000000) // check fail, got 12000000000000
f("9223372", 9223372000000000)
f("9223372.0", 9223372000000000) // check fail, got 9223372000000000000
// bigger than maxValidSecond
f("9223373", 9223373000000000)
f("9223373.0", 9223373000000000) // check success
f("1700000000", 1700000000000000000)
f("1700000000.0", 1700000000000000000) // check success
// nanoseconds
f("-1234567890123456789", -1234567890123456789)
f("1234567890123456789", 1234567890123456789)