Skip to content

Fix strftime microseconds on Windows#1139

Open
LunaMeerkats wants to merge 1 commit into
skyfielders:masterfrom
LunaMeerkats:agent/fix-windows-strftime-microseconds
Open

Fix strftime microseconds on Windows#1139
LunaMeerkats wants to merge 1 commit into
skyfielders:masterfrom
LunaMeerkats:agent/fix-windows-strftime-microseconds

Conversation

@LunaMeerkats

Copy link
Copy Markdown

Summary

  • replace the platform-dependent %Z placeholder with direct %f insertion
  • support repeated %f directives while preserving escaped percent sequences
  • extend scalar and array regression coverage

Root cause

Skyfield passed microsecond text through a synthetic tenth struct_time field
and formatted it as %Z. Windows ignores that supplied timezone value and
expands %Z using the host timezone, so %f rendered text such as
AUS Eastern Standard Time instead of six digits.

Fixes #1081.

Validation

  • direct Windows 11 reproducer: 2025-05-14T05:15:36.894280Z
  • focused microsecond regression, including repeated and escaped directives
  • compatible full test run: 581 passed; the only 2 failures are pre-existing
    Windows failures where time.strftime() rejects year -746
  • python -m pyflakes skyfield
  • python -m compileall -q skyfield
  • clean wheel build

The project's Assay runner imports the Unix-only fcntl module, so I used a
compatible local fixture-expansion runner on Windows. Linux validation remains
for project CI.

OpenAI Codex assisted with investigation, implementation, and validation. The
final diff and evidence were independently reviewed before publication.

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.

%f doesn't work in xxx_strftime() functions

1 participant