google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.31k stars 209 forks source link

Remove debug clock from Time.String() #524

Closed marco6 closed 8 months ago

marco6 commented 8 months ago

Time.String() states in the documentation that it formats time according to the string 2006-01-02 15:04:05.999999999 -0700 MST, however it uses time.Time.String() methods which, if available, adds to that string the monotonic clock, leading to inconsistent output. For example:

>>> time.now()
2024-01-23 14:47:50.352396992 +0100 CET m=+210.079650729
>>> time.parse_time("2024-01-23T14:47:50.352396992+01:00")
2024-01-23 14:47:50.352396992 +0100 CET

This PR uses a format string instead, so that the output does never contain the monotonic clock.