• Jay Weisskopf's avatar
    runtime: use monotonic clock for timers (linux/386, linux/amd64) · 86c976ff
    Jay Weisskopf authored
    This lays the groundwork for making Go robust when the system's
    calendar time jumps around. All input values to the runtimeTimer
    struct now use the runtime clock as a common reference point.
    This affects net.Conn.Set[Read|Write]Deadline(), time.Sleep(),
    time.Timer, etc. Under normal conditions, behavior is unchanged.
    
    Each platform and architecture's implementation of runtime·nanotime()
    should be modified to use a monotonic system clock when possible.
    
    Platforms/architectures modified and tested with monotonic clock:
      linux/x86     - clock_gettime(CLOCK_MONOTONIC)
    
    Update #6007
    
    LGTM=dvyukov, rsc
    R=golang-codereviews, dvyukov, alex.brainman, stephen.gutekanst, dave, rsc, mikioh.mikioh
    CC=golang-codereviews
    https://golang.org/cl/53010043
    86c976ff
sleep.go 3.17 KB