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

tui: use RFC3339-alike format with second precision for "Time" #903

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

aktau
Copy link
Contributor

@aktau aktau commented Oct 8, 2024

The current time format (Jan 2, 2006 at 3:04pm (MST)) has a few issues:

  • It displays time at minute granularity, while profiles usually have have second-level (and more1) granularity.
  • It uses a 12-hour clock, which is tricky to handle at AM/PM switchovers, for people (like myself) who are not used to it. By contrast, a 24-hour clock is unambiguous.
  • Minor: using names for months makes it more difficult to calculate with time differences.

Hence, I propose replacing it with an RFC3339-alike format, with spaces between elements for better readability.

Footnotes

  1. https://github.com/golang/go/blob/3aa71c12eacd68ec16e7172d92aa5c6af32f0c3b/src/runtime/pprof/proto.go#L351

@codecov-commenter
Copy link

codecov-commenter commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.95%. Comparing base (0ed6a68) to head (6be65a6).
Report is 46 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #903      +/-   ##
==========================================
+ Coverage   66.86%   66.95%   +0.09%     
==========================================
  Files          44       44              
  Lines        9824     9857      +33     
==========================================
+ Hits         6569     6600      +31     
- Misses       2794     2817      +23     
+ Partials      461      440      -21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aalexand
Copy link
Collaborator

aalexand commented Oct 8, 2024

@aktau It's unfortunate that no test had to be updated. Should we look into adding a test that would verify the change? My worry is that by just looking at the code I can't tell if we used a format string that will work as expected. If adding an automated test is too much hassle then could you confirm that you tested the change manually / locally?

@aktau
Copy link
Contributor Author

aktau commented Oct 9, 2024

OK, I added a test. PTAL.

The current time format (Jan 2, 2006 at 3:04pm (MST)) has a few issues:

 - It displays time at minute granularity, while profiles usually have
   have second-level (and more[^go]) granularity.
 - It uses a 12-hour clock, which is tricky to handle at AM/PM
   switchovers, for people (like myself) who are not used to it. By
   contrast, a 24-hour clock is unambiguous.
 - Minor: using names for months makes it more difficult to calculate
   with time differences.

Hence, I propose replacing it with an RFC3339-alike format, with spaces
between elements for better readability.

[^go]: https://github.com/golang/go/blob/3aa71c12eacd68ec16e7172d92aa5c6af32f0c3b/src/runtime/pprof/proto.go#L351
@aalexand aalexand merged commit a352233 into google:main Oct 9, 2024
31 checks passed
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.

3 participants