
Monotonic and wall clock time in the Go time package
valyala
created: July 25, 2025, 6:05 p.m. | updated: July 25, 2025, 8:34 p.m.
Monotonic and Wall Clock Time in the Go time packageModern operating systems usually keep track of two kinds of clocks: a wall clock and a monotonic clock.
Since wall clocks can jump forward or backward, slow down, or speed up, measuring time intervals directly using the wall clock can cause errors.
To fix these issues, operating systems also use a second type of clock: a monotonic clock.
This struct actually holds two different values: the wall clock time and an (optional) monotonic clock reading.
Sub ( t ) }If you use time.Since with a time.Time value that does not have the monotonic clock, you can run into problems:// parse the time (wall clock only, no monotonic) lastModified , _ := time .
1 day, 5 hours ago: Hacker News: Front Page