Skip to content

Read EPOCHREALTIME the same way under a comma-decimal locale - #15213

Merged
dhh merged 1 commit into
quattrofrom
epochrealtime-locale
Oct 13, 2026
Merged

dhh merged 1 commit into
quattrofrom
epochrealtime-locale

Conversation

@dhh

@dhh dhh commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

What changed

Bash writes $EPOCHREALTIME with the locale's decimal separator. Under da_DK, de_DE or fr_FR it reads 1791832819,402790, not 1791832819.402790. Three commands assumed a dot:

  • omarchy-dev-benchmark-cli and omarchy-dev-benchmark-theme-switcher built microseconds with ${EPOCHREALTIME/./}. That left the comma in, so the $(( )) arithmetic on it went wrong: the comma operator, or an invalid-octal error when the fraction starts with 0 and contains an 8 or 9. Both now use ${EPOCHREALTIME//[!0-9]/}, as omarchy-system-sleep-lock already does.
  • omarchy-disk-speedtest handed $EPOCHREALTIME to awk, which only takes a dot as the decimal point. Each timestamp therefore became a whole second and skewed the steady-state rate. It now swaps the comma for a dot first.

Found while reviewing #15192, which had the same bug and fixes it there.

Tests

New test/shell.d/epochrealtime-locale-test.sh builds a da_DK locale with localedef in a temp dir, confirms bash writes a comma there, and runs both benchmarks' now_us under it. It skips when localedef can't build the locale. I mutation-checked it: quattro's now_us prints 1791833200,519263 and fails. The disk speed test needs a block device and a minute of I/O, so it has no test here.

🤖 Generated with Claude Code

Bash writes it with the locale's decimal separator, so stripping a dot
left a comma behind in the benchmark clocks, and awk read the disk speed
test's timestamps as whole seconds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

This PR fixes clock calculations under comma-decimal locales.

  • CLI and theme benchmarks measure time with comma-decimal clocks.
  • Disk speed timing keeps fractional seconds under comma locales.

No actionable issues were found. Runtime tests were not run during this review.

Reviews (1) · Last reviewed commit: "Read EPOCHREALTIME the same way under a ..." · Reviewed by Greptile

@dhh
dhh merged commit c2cfa60 into quattro Oct 13, 2026
1 check passed
@dhh
dhh deleted the epochrealtime-locale branch October 13, 2026 12:35
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
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.

2 participants