Re: DT_DATE_TIME_DURATION usage

Berend de Boer <[email protected]> Thu, 29 May 2008 13:38:05 +1200
Newsgroups gmane.comp.lang.eiffel.gobo.general
Message-ID <[email protected]>
>>>>> "Eric" == Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]> writes:

    Eric> ~~~~~~~~~~~~~~~~~~~ Let's consider that you have a duration of
    Eric> 1 month, and you want to quarter of it. What should it be?
    Eric> Well, I guess it depends on what you want to do with that
    Eric> duration. If it's to be added to a date, then the result
    Eric> depends on that date. In that case I would suggest turning the
    Eric> duration into a definite duration (using `to_definite').
    Eric> ~~~~~~~~~~~~~~~~~~~

    Eric> Indeed, one month to be added to 1 Feb 2007 is equivalent to
    Eric> 28 days.  So a quarter of it will be 7 days. But when to be
    Eric> added to 1 Jan 2007 it is equivalent to 31 days. And a quarter
    Eric> of it will be 7 days and 18 hours.

Hmm, maybe my original question wasn't precise enough then.

I have two dates, a begin and end date. I want to divide the duration
between these days in X divisions. For my purposes it would be enough
to know the number of seconds between these two dates. I don't care
about leap seconds for this application.

I can get a DT_DATE_TIME_DURATION between these two dates of course, but
I'm still unsure what to_definite does with the date I pass.

Is there any other way to get the seconds between these two dates?
Perhaps DT_DATE_TIME should have an epoch_time feature which returns the
number of seconds, that would make such calculations far more trivial.

-- 
Cheers,

Berend de Boer


[Non-text portions of this message have been removed]