fix: more fixes to time parsing#205
Merged
Merged
Conversation
While working on asdf-formatgh-201 I wanted to use setting a time as a simple example but exercising the time extension more revealed further problems: - parsing doesn't work for jyear format times -- this is now added, as well as for the decimalyear format; leaving more formats to support for a follow-up issue - corrected not-quite-right handling of time values given as numerical scalars; rather than parsing their numerical values out of YAML and then re-formatting them, just take the YAML scalar verbatim, as the individual format parsers expect - fixed deserialization of the optional 'scale' property, which previously always defaulted to 'utc'. This was a certainly intended as a TODO but forgot to note it
embray
commented
Jun 24, 2026
| * determined. The return type is a signed ``int`` (not the enum) because | ||
| * `asdf_time_format_t` may be an unsigned type, in which case a -1 enum value | ||
| * would compare as a large positive number. | ||
| */ |
Collaborator
Author
There was a problem hiding this comment.
Also fixed this -- a mistake a make frequently actually. It's not portable to treat an enum value as a signed int.
Collaborator
Author
|
Ah shoot, I jumped the gun a little on this, because this still doesn't actually fix the case I was trying to fix for #201. |
embray
added a commit
that referenced
this pull request
Jun 24, 2026
For values in decimal formats the time format is ambiguous and should not be guessed. Likewise, according the the actual schema, the string formats are only valid in the schema if they are guessable, basically (i.e. 'J2000.0', not just '2000.0', even if `format: jyear` is specified. Follow-up to #205 which intended to fix this as well.
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.
While working on gh-201 I wanted to use setting a time as a simple example but exercising the time extension more revealed further problems:
parsing doesn't work for jyear format times -- this is now added, as well as for the decimalyear format; leaving more formats to support for a follow-up issue
corrected not-quite-right handling of time values given as numerical scalars; rather than parsing their numerical values out of YAML and then re-formatting them, just take the YAML scalar verbatim, as the individual format parsers expect
fixed deserialization of the optional 'scale' property, which previously always defaulted to 'utc'. This was a certainly intended as a TODO but forgot to note it