Skip to content

time: trim monotonic clock reading in Round, Truncate, In, Local, UTC? #18991

@rogpeppe

Description

@rogpeppe

An interesting ramification of the new monotonic time issue, perhaps not solvable.

I just wrote some code that looked a bit like this:

 t0 := time.Now().Truncate(time.Millisecond)
 something()
 t1 := time.Now().Truncate(time.Millisecond)
 fmt.Println(t1.Sub(t0))

and expected it to print a duration that's a whole number of milliseconds but it doesn't, because of the variable skew between the monotonic and wall clock times.

https://play.golang.org/p/pn2AWxrRU0

go version devel +5f374ea Mon Feb 6 22:45:49 2017 +0000 linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions