Boost logo

Boost :

From: Carlo Wood (carlo_at_[hidden])
Date: 2006-05-15 19:20:46


On Mon, May 15, 2006 at 06:02:34PM +0200, Gerhard Wesp wrote:
> Having implemented several major frameworks in C++ in which time played
> a crucial rule, I have a pretty firm view on the subject: No time type
> should include information about relative to which point it is measured.

This doesn't give arguments.

> > that the two are the same thing, but I'd argue that it would be
> > better to make TWO types.
>
> I strongly disagree, for the above reasoning.

Though you are theoretically correct to say that also
the time as returned by -whatever- (ie, gettimeofday) is
relative to some point, it isn't very practical to consider
it's value relative.

The concept of "NOW" seems clear to me. And "NOW" is an
absolute time, not a relative one. The fact that one HAS to
store/represent it as a relative time is exactly what is so
confusing, and THEREFORE calls for a separate type.

It makes no sense to code,

  Time t1 = now();
  Time t2 = now();
  Time t3 = t1 + t2;

as the result of the addition would be dependent on the time
that the *implementation* of Time is relative to (ie, 1970).
But the coder in general will not care if 'now' is relative
stored relative to 1970 or to 2005: he should be shielded
from that. Therefore, adding Time + Time should not compile.

I think these are sound argument FOR two types, and AGAINST
just a single type for relative time.

-- 
Carlo Wood <carlo_at_[hidden]>

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk