For a DateTime::SpanSet object, you can call ->duration(), it returns
a DateTime::Duration object.

Iterating over the spans also work.

2013/11/29 Andreas Isberg <andreas.isb...@gmail.com>:
> Hi, I'm trying to find a way to perform math with the duration of a
> DateTime::SpanSet. I'd prefer it to be in seconds, but I can't find anything
> from it in the documentation.
>
> What I did find is that the DateTime module has a subtract_datetime_absolute
> function that would give me seconds and nanoseconds from two DateTime
> objects.
> So I guess one way to do this is to iterate over the entire
> DateTime::SpanSet, and for all DateTime::Span perform
> subtract_datetime_absolute for the start and end of it, and sum it all. I
> haven't tried this yet tho..
>
> Would this approach work, or is there any other better way?
>
> Kind regards,
> Andreas Isberg
> Telefon: 072-588 91 95

Reply via email to