On Fri, Mar 28, 2014 at 5:19 PM, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
> ISO 8601 doesn't seem to define a representation for
> negative durations, though, so it wouldn't solve the
> original problem.

Aside from the horribleness of the ISO 8601 notation for a duration, it's
best not to confuse the notions of duration and delta.  Notionally, a delta
contains more information than a duration.

and less -- really it's different.
A duration would be really useful actually, for things like "next month", etc,. IIRC, mxDateTime has something for this, but it's NOT the same as a timedelta.">

(original) (raw)

On Fri, Mar 28, 2014 at 2:52 PM, Fred Drake <fred@fdrake.net> wrote:
On Fri, Mar 28, 2014 at 5:19 PM, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
\> ISO 8601 doesn't seem to define a representation for
\> negative durations, though, so it wouldn't solve the
\> original problem.

Aside from the horribleness of the ISO 8601 notation for a duration, it's
best not to confuse the notions of duration and delta. Notionally, a delta
contains more information than a duration.

and less -- really it's different.

A duration would be really useful actually, for things like "next month", etc,. IIRC, mxDateTime has something for this, but it's NOT the same as a timedelta.

timedelta appears to be analogous to ISO 8601's " time interval", which requires

  1. Start and end, such as "2007-03-01T13:00:00Z/2008-05-11T15:30:00Z"
  2. Start and duration, such as "2007-03-01T13:00:00Z/P1Y2M10DT2H30M"
  3. Duration and end, such as "P1Y2M10DT2H30M/2008-05-11T15:30:00Z"
  4. Duration only, such as "P1Y2M10DT2H30M", with additional context information


I don't think there is or should be a any direct mapping from timedelta to ISO duration.

-Chris

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax

Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov