
Bart Heupers wrote:
If you add the start date you still don't know how long it is. 2005-08-09T18:31:42P6M4DT12H30M17S How many seconds is that?
You are aware that that is an underspecified time? The timezone is omitted, and even with that you still would not know what DST rules to apply. And that's leaving aside the problems you've identified too. All this just goes to show that time arithmetic is hard, and best left to libraries where someone else has sorted out all the problems. [...]
Then the ISO8601 specification is not ambiguous. But I would prefer to use seconds.
It's not ambiguous. It's your "normalization" code that is wrong. :-) False normalization of values causes real trouble; it is not possible to do this correctly with durations, and because of this, if normalization is to be done, it must be done immediately before display to a real user, and not at any intermediate stage. If you want to use seconds, do so: PT<YourNumberGoesHere>S If you wish, within your Grid, to profile (i.e. restrict) the use of the usage record to require that durations are always expressed only using seconds, you can do just that. Donal.