[LRUG] Finding the duration between two DateTimes

Piers Cawley pdcawley at bofh.org.uk
Tue May 29 05:33:59 PDT 2007


On 28/05/07, Eleanor <eleanor at goth-chic.org> wrote:
> Then where you currently create your duration you could write:
>
>         duration = Duration.new(Task.duration)
>
> However from the perspective of a Task object you may not need any of
> this complexity. Just because something can be made into an object
> doesn't necessarily mean that it should...

However, in the case of calendrical calculations, reifying a duration
makes a great deal of sense. Representing a duration internally as a
number of seconds makes a great deal less sense though. Consider the
problems inherent in 1.month, daylight savings, leap years, leap
seconds and the whole jujuflop situation that is timezones.



More information about the Chat mailing list