2 Commits

View File

@@ -358,7 +358,7 @@ func TestLower16BitPrivateIP(t *testing.T) {
func TestToTime(t *testing.T) {
start := time.Now()
sf := newSonyflake(t, Settings{
TimeUnit: time.Millisecond,
TimeUnit: 100 * time.Millisecond,
StartTime: start,
})
@@ -366,7 +366,7 @@ func TestToTime(t *testing.T) {
tm := sf.ToTime(id)
diff := tm.Sub(start)
if diff < 0 || diff >= time.Duration(sf.timeUnit) {
if diff < 0 || diff > time.Duration(sf.timeUnit) {
t.Errorf("unexpected time: %v", tm)
}
}