Re: DT_DATE_TIME_DURATION usage

Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]> Wed, 28 May 2008 23:19:16 +0200
Newsgroups gmane.comp.lang.eiffel.gobo.general
Message-ID <[email protected]>
Berend de Boer wrote:
>>>>>> "Eric" == Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]> writes:
> 
>     Eric> There is nothing readily available. Let's consider that you
>     Eric> have a duration of 1 month, and you want to quarter of
>     Eric> it. What should it be? Well, I guess it depends on what you
>     Eric> want to do with that duration. If it's to be added to a date,
>     Eric> then the result depends on that date. In that case I would
>     Eric> suggest turning the duration into a definite duration (using
>     Eric> `to_definite'). Then turn it into a number of milliseconds
>     Eric> (days * milliseconds_in_days + millisecond_count). Then you
>     Eric> can divide by 4 and create a new date-time-duration using
>     Eric> `make_precise_canonical_definite'.
> 
> That should work yeah. I'll try that.
> 
> Would it be a good idea to add '*' and '/' operators to this class? They
> would take a number as argument and return a new duration.

You need an extra argument: a date-time.

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