diff --git a/unix/syscall_aix_test.go b/unix/syscall_aix_test.go index 6787643b..7563dc2f 100644 --- a/unix/syscall_aix_test.go +++ b/unix/syscall_aix_test.go @@ -49,13 +49,13 @@ func TestTime(t *testing.T) { } now = time.Now() - - if int64(ut) == now.Unix() { + diff := int64(ut) - now.Unix() + if -1 <= diff && diff <= 1 { return } } - t.Errorf("Time: return value %v should be nearly equal to time.Now().Unix() %v", ut, now.Unix()) + t.Errorf("Time: return value %v should be nearly equal to time.Now().Unix() %v±1", ut, now.Unix()) } func TestUtime(t *testing.T) { diff --git a/unix/syscall_linux_test.go b/unix/syscall_linux_test.go index adc59b12..d3f2bc3e 100644 --- a/unix/syscall_linux_test.go +++ b/unix/syscall_linux_test.go @@ -125,13 +125,13 @@ func TestTime(t *testing.T) { } now = time.Now() - - if int64(ut) == now.Unix() { + diff := int64(ut) - now.Unix() + if -1 <= diff && diff <= 1 { return } } - t.Errorf("Time: return value %v should be nearly equal to time.Now().Unix() %v", ut, now.Unix()) + t.Errorf("Time: return value %v should be nearly equal to time.Now().Unix() %v±1", ut, now.Unix()) } func TestUtime(t *testing.T) {