solar: Fix +z time zone offsets truncated to whole hours - #9221
Merged
Merged
Conversation
pssolar_parse_date_tz() used atoi() on the +z<TZ> suffix, which stops at the first non-numeric character, so +z08:30 and +z08:00 both parsed to 8. Change TZ from int to double throughout (PSSOLAR_I, PSSOLAR_T, the parser signature, and locals in parse()/pssolar_params()) and replace atoi with a [-]hh[:mm] parser. Fixes #9220 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Extend the [-]hh[:mm] timezone parser to [-]hh[:mm[:ss]] so a second colon-separated field (e.g. +z08:30:15) is added as sec/3600 instead of being silently dropped. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace the hand-rolled [-]hh[:mm[:ss]] parser with gmt_scanf_arg (GMT_IS_GEO), which already handles that format including the -00:30 sign case, and report a parse error for malformed time zones instead of silently using a wrong offset. Document the accepted format (and use ASCII minus signs in the examples so they can be copy-pasted), and add a self-checking test that recovers the offset from the -C output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seconds are still accepted by the parser, but they are not useful for real time zones, so leave them out of the docs, usage and error message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Esteban82
marked this pull request as ready for review
September 23, 2026 12:28
seisman
approved these changes
Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
solarignored the minutes of the+ztime zone offset:+z08:30gave the same result as+z08:00. The offset was read withatoi, which stops at the:.The offset is now parsed with
gmt_scanf_arg(GMT_IS_GEO), so[-]hh[:mm]works for both-Iand-T(e.g.+z05:45,+z-03:30). A malformed value such as+zabcnow gives a parse error instead of silently falling back to UTC.It also works for time zones that include seconds, which isn't particularly useful, but that's just how it was implemented. The docs only describe
[-]hh[:mm].Fixes #9220
Reproduction
🤖 Generated with Claude Code. Review with Opus 5.5.