#600 closed defect (fixed)
psTimeFromISO fails to parse an ISO time
| Reported by: | Paul Price | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | astro | Version: | 0.8.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Attempting to parse a valid ISO time results in:
2005:11:23 18:01:46Z|mithrandir |E|psTimeFromISO (psTime.c:1375)
Specified ISO Time string, '2005-11-23T12:34:56.789', is malformed. Must be
in 'YYYY-MM-DDThh:mm:ss.sss' format.
This is due to the following snippet in psTime.c:
Convert YYYY-MM-DDThh:mm:ss.sss in string form to tm time
if (sscanf(input, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon,
&tmTime.tm_mday,
&tmTime.tm_hour, &tmTime.tm_min, &tmTime.tm_sec,&millisecond) < 7) {
psError(PS_ERR_BAD_PARAMETER_VALUE, true,
PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, input);
return NULL;
}
Note the presence of a comma in the sscanf format, which should be a decimal
point (this despite the comment line above).
The string testTime1Str in tst_psTime_01.c which is used to test psTimeFromISO
also contains a comma, which causes the test to pass.
Change History (6)
comment:1 by , 21 years ago
comment:2 by , 21 years ago
| Status: | new → assigned |
|---|
comment:3 by , 21 years ago
| Owner: | changed from to |
|---|---|
| Status: | assigned → new |
comment:4 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
replaced the comma with a period

Identified the comma in the SDRS and fixed it.
Note also that fractions of a second are optional, and are not always included
in an ISO time.