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

Timezone-aware output for age #9899

Closed
bbjubjub2494 opened this issue Feb 16, 2025 · 0 comments · Fixed by #9913
Closed

Timezone-aware output for age #9899

bbjubjub2494 opened this issue Feb 16, 2025 · 0 comments · Fixed by #9913
Assignees
Labels
C-cast Command: cast P-low Priority: low T-feature Type: feature

Comments

@bbjubjub2494
Copy link

bbjubjub2494 commented Feb 16, 2025

Component

Cast

Describe the feature you would like

cast age currently produces a timestamp in human-readable format that does not carry a timezone indication. This is ambiguous because it is implicitly in the UTC timezone, but other tools might assume that it is in a contextual local timezone. This can lead users to compute incorrect values — e.g. block timestamps that are off by one or more hour — in normal usage and can be very hard to debug. It would suffice to add " UTC" to the output to resolve this ambiguity.

Additional context

Say you want to compute the timestamp of the block at which that the merge happened on Mainnet on a Linux machine. You could combine Foundry with the standard date command to obtain that information. However, if your timezone is different than UTC (here Europe/Zurich), the naive command combination below will give an incorrect result. The two alternatives that follow give the correct result

$ date +%s -d "`cast age 15537394`"  # incorrect result
1663216979
$ date +%s -d "`cast age 15537394` UTC"  # simulating foundry-side fix
1663224179
$ date +%s -ud "`cast age 15537394`"  # ad-hoc fix
1663224179
@bbjubjub2494 bbjubjub2494 added T-feature Type: feature T-needs-triage Type: this issue needs to be labelled labels Feb 16, 2025
@github-project-automation github-project-automation bot moved this to Todo in Foundry Feb 16, 2025
@grandizzy grandizzy added P-low Priority: low C-cast Command: cast and removed T-needs-triage Type: this issue needs to be labelled labels Feb 18, 2025
@zerosnacks zerosnacks self-assigned this Feb 18, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast P-low Priority: low T-feature Type: feature
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants