github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/time/monotonic/func.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package monotonic
     4  
     5  import (
     6  	_ "unsafe" // for go:linkname
     7  )
     8  
     9  type (
    10  	// A Time monotonic clock is for measuring time.
    11  	// time-measuring operations, specifically comparisons and subtractions, use the monotonic clock.
    12  	NanoSecElapsed int64
    13  )
    14  
    15  // RuntimeNano returns the current value of the runtime monotonic clock in nanoseconds.
    16  // It isn't not wall clock, Use in tasks like timeout, ...
    17  //go:linkname RuntimeNano runtime.nanotime
    18  func RuntimeNano() int64
    19  
    20  // Now returns runtime monotonic clock in nanoseconds.
    21  func Now() NanoSecElapsed {
    22  	return NanoSecElapsed(RuntimeNano())
    23  }