Re: DT_DATE_TIME_DURATION usage

Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]> Wed, 28 May 2008 12:08:35 +0200
Newsgroups gmane.comp.lang.eiffel.gobo.general
Message-ID <[email protected]>
Berend de Boer wrote:
> I would like to have a duration that is a quarter (or a third) of
> another duration. Is that possible?

There is nothing readily available. Let's consider that you have
a duration of 1 month, and you want to quarter of it. What should
it be? Well, I guess it depends on what you want to do with that
duration. If it's to be added to a date, then the result depends
on that date. In that case I would suggest turning the duration
into a definite duration (using `to_definite'). Then turn it into
a number of milliseconds (days * milliseconds_in_days +
millisecond_count). Then you can divide by 4 and create a new
date-time-duration using `make_precise_canonical_definite'.

-- 
Eric Bezault
mailto:ericb-D6Qt/9opevxWk0Htik3J/[email protected]
http://www.gobosoft.com