[
https://issues.apache.org/jira/browse/AXIS2C-1350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Lazarski resolved AXIS2C-1350.
-------------------------------------
Resolution: Not A Problem
The current Axis2/C code is spec-compliant. Here's why:
ISO 8601 / XML Schema Rules
1. PT25H is VALID - ISO 8601 does not require normalization. Values
like 25 hours, 70 minutes, or 90 seconds are all valid lexical
representations.
2. No normalization is mandated - The
https://www.w3.org/TR/xmlschema-2/ spec defines the lexical space but
does NOT require overflow normalization.
3. Normalization is problematic - The spec explicitly notes that
months/years cannot be reliably converted to days because month
lengths vary (28-31 days). This is why
https://www.w3.org/TR/xmlschema11-2/ introduced separate
yearMonthDuration and dayTimeDuration subtypes.
From the https://www.ietf.org/archive/id/draft-tsai-duration-00.html:
"ISO 8601 permits the use of year, month, week, and day units in
representing a duration, but none of these can be reliably converted
to a fixed duration value without further context."
> Adding hours/mins/secs etc to the duration does not add up correctly
> --------------------------------------------------------------------
>
> Key: AXIS2C-1350
> URL: https://issues.apache.org/jira/browse/AXIS2C-1350
> Project: Axis2-C
> Issue Type: Bug
> Components: util
> Reporter: Damitha N.M. Kumarage
> Priority: Major
>
> axis2_char_t *duration_str = "P19Y6M4DT12H30M5S";
> printf("input:%s\n", duration_str);
> axutil_duration_t *duration = NULL;
> axis2_char_t *result = NULL;
> duration = axutil_duration_create_from_string(env, duration_str);
> int hours = axutil_duration_get_hours(duration, env);
> axutil_duration_set_hours(duration, env, hours + 13);
> result = axutil_duration_serialize_duration(duration, env);
> printf("result:%s\n", result);
> The output of the above program should ideally be
> input:P19Y6M4DT12H30M5S
> result:P19Y6M5DT1H30M5.000000S
> But it is actually is
> input:P19Y6M4DT12H30M5S
> result:P19Y6M4DT25H30M5.000000S
> When hours exceed 24 it should be counted as 1 days and 1 hour instead of 25
> hours. This problem is there for other time units as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]