Source file src/testing/testing_windows_test.go

     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  
     5  package testing_test
     6  
     7  import (
     8  	"testing"
     9  	"time"
    10  )
    11  
    12  var sink time.Time
    13  var sinkHPT testing.HighPrecisionTime
    14  
    15  func BenchmarkTimeNow(b *testing.B) {
    16  	for i := 0; i < b.N; i++ {
    17  		sink = time.Now()
    18  	}
    19  }
    20  
    21  func BenchmarkHighPrecisionTimeNow(b *testing.B) {
    22  	for i := 0; i < b.N; i++ {
    23  		sinkHPT = testing.HighPrecisionTimeNow()
    24  	}
    25  }
    26  

View as plain text