github.com/Psiphon-Inc/goarista@v0.0.0-20160825065156-d002785f4c67/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_test 7 8 import ( 9 "testing" 10 11 . "github.com/aristanetworks/goarista/monotime" 12 ) 13 14 func TestNow(t *testing.T) { 15 for i := 0; i < 100; i++ { 16 t1 := Now() 17 t2 := Now() 18 // I honestly thought that we needed >= here, but in some environments 19 // two consecutive calls can return the same value! 20 if t1 > t2 { 21 t.Fatalf("t1=%d should have been less than or equal to t2=%d", t1, t2) 22 } 23 } 24 }