Boost logo

Boost :

From: Mark Rodgers (mark.rodgers_at_[hidden])
Date: 2002-04-23 13:59:39


From: "Glen Knowles" <gknowles_at_[hidden]>
>
> But what is a "date<long>" ? In order to convert to a calendar system or
do
> any comparisons you have to know the beginning of the epoch and the
> increment. A "date" could be measured in seconds since Jan 1, 1970 or it
> could be measured in years since the beginning of time.
>
> Is "gregorian::date" harder to write then date<long, epoch, increment> ?

I think a date is just a date and its internal representation (be it seconds
since Jan 1 1970 or years since the beginning of time) is an implementation
detail.

  date d1 = date::today();

Would give a date that represented today, and is completely calendar
independent. Likewise

  date d2 = date::tomorrow();
  assert(d1 < d2);
  std::string s1 = gregorian::to_string(d1);
  std::string s2 = julian::to_string(d2);
  date d3 = gregorian::from_string("1 Jan 1970");

Why do I need to know the internal representation of date?

Mark


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