github.com/psiphon-Labs/psiphon-tunnel-core@v2.0.28+incompatible/psiphon/common/monotime/nanotime_test.go (about) 1 // Copyright (C) 2016 Arista Networks, Inc. 2 // Use of this source code is governed by the Apache License 2.0 3 // that can be found in the COPYING file. 4 5 // Package monotime provides a fast monotonic clock source. 6 package monotime 7 8 import ( 9 "testing" 10 ) 11 12 func TestNow(t *testing.T) { 13 for i := 0; i < 100; i++ { 14 t1 := Now() 15 t2 := Now() 16 // I honestly thought that we needed >= here, but in some environments 17 // two consecutive calls can return the same value! 18 if t1 > t2 { 19 t.Fatalf("t1=%d should have been less than or equal to t2=%d", t1, t2) 20 } 21 } 22 }