Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove debug clock from Time.String() #524

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

marco6
Copy link
Contributor

@marco6 marco6 commented Jan 23, 2024

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.

Copy link
Collaborator

@adonovan adonovan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks for contributing a fix.

@adonovan adonovan merged commit f864706 into google:master Jan 23, 2024
13 checks passed
@marco6 marco6 deleted the remove-monotonic-clock branch January 23, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants