Source file src/runtime/timestub.go

     1  // Copyright 2017 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  // Declarations for operating systems implementing time.now
     6  // indirectly, in terms of walltime and nanotime assembly.
     7  
     8  //go:build !faketime && !windows && !(linux && amd64)
     9  
    10  package runtime
    11  
    12  import _ "unsafe" // for go:linkname
    13  
    14  // time_now should be an internal detail,
    15  // but widely used packages access it using linkname.
    16  // Notable members of the hall of shame include:
    17  //   - gitee.com/quant1x/gox
    18  //   - github.com/phuslu/log
    19  //   - github.com/sethvargo/go-limiter
    20  //   - github.com/ulule/limiter/v3
    21  //
    22  // Do not remove or change the type signature.
    23  // See go.dev/issue/67401.
    24  //
    25  //go:linkname time_now time.now
    26  func time_now() (sec int64, nsec int32, mono int64) {
    27  	sec, nsec = walltime()
    28  	return sec, nsec, nanotime()
    29  }
    30  

View as plain text