1// Copyright 2024 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package testing_test 6 7import ( 8 "testing" 9 "time" 10) 11 12var sink time.Time 13var sinkHPT testing.HighPrecisionTime 14 15func BenchmarkTimeNow(b *testing.B) { 16 for i := 0; i < b.N; i++ { 17 sink = time.Now() 18 } 19} 20 21func BenchmarkHighPrecisionTimeNow(b *testing.B) { 22 for i := 0; i < b.N; i++ { 23 sinkHPT = testing.HighPrecisionTimeNow() 24 } 25} 26