Skip to content

Commit 3ef459a

Browse files
Fix time duration comparison in ToTime test to ensure correct validation of generated timestamps.
1 parent 2343cac commit 3ef459a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

v2/sonyflake_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func TestToTime(t *testing.T) {
366366

367367
tm := sf.ToTime(id)
368368
diff := tm.Sub(start)
369-
if diff < 0 || diff >= time.Duration(sf.timeUnit) {
369+
if diff < 0 || diff > time.Duration(sf.timeUnit) {
370370
t.Errorf("unexpected time: %v", tm)
371371
}
372372
}

0 commit comments

Comments
 (0)