Skip to content

Commit 19d4394

Browse files
committed
fix within check
1 parent 9d30bd4 commit 19d4394

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

utils/now_unix_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ func TestCustomTimeNow(t *testing.T) {
1919
customTimestamp := Now().UnixNano()
2020

2121
// two timestamp should within 1 percistion
22-
assert.Equal(t, timestamp <= customTimestamp, true, fmt.Sprintf("Loop %d: timestamp <= customTimestamp should be true. timestamp: %d, customTimestamp: %d", i, timestamp, customTimestamp))
23-
assert.Equal(t, timestamp+int64(precision) >= customTimestamp, true, fmt.Sprintf("Loop: %d: customTimestamp should within %s. timestamp: %d, customTimestamp: %d", i, precision.String(), timestamp, customTimestamp))
22+
assert.Equal(t, timestamp+int64(precision) >= customTimestamp && timestamp-int64(precision) <= customTimestamp, true, fmt.Sprintf("Loop: %d: customTimestamp should within %s. timestamp: %d, customTimestamp: %d", i, precision.String(), timestamp, customTimestamp))
2423

2524
os.Setenv("TZ", fmt.Sprintf("UTC%d", 14-i%27))
2625
time.Sleep(time.Nanosecond)

0 commit comments

Comments
 (0)