Boost logo

Boost :

Subject: Re: [boost] [gsoc 2013] draft proposal for chrono::date
From: Anders Dalvander (boost_at_[hidden])
Date: 2013-05-05 13:09:40


On 2013-05-05 13:41, Anders Dalvander wrote:
> Same here, the date May 5th 2013 represent the time range [2013-05-05
> 00:00, 2013-05-05 24:00), but that time range is different for
> different people around the world. It would be, in my humble opinion,
> better to keep `chrono::date` abstract, without any connection to a
> timezone.
>
> Same with `chrono::time` (or whatever it would be called), it could be
> the time 12:34:56, but that cannot be represented as an instant in
> time (i.e. `chrono::time_point`). Neither can the combined
> `chrono::date` and `chrono::time`, it is still without any connection
> to a timezone. Perhaps it's better to explain myself with code:
>
> chrono::date d = year(2013) / may / day(5);
> chrono::time t = hours(12) + minutes(34) + seconds(56);
> chrono::date_time dt(d, t);
> // Here `dt` should be the representation of May 5th 2013 at 12:34:56,
> but that in turn occurred at different instants for different people
> around the world.
> // In order to convert it to a `system_time` a timezone would be needed:
> chono::system_time st = dt.in_timezone(chrono::timezones::utc); // or
> perhaps `dt.in_utc()` for short.

Sorry about that, should be:

chrono::date d = year(2013) / may / day(5);
chrono::time t = hours(12) + minutes(34) + seconds(56);
chrono::date_time dt(d, t);
// Here `dt` should be the representation of May 5th 2013 at 12:34:56,
but that in turn occurred at different instants for different people
around the world.
// In order to convert it to a `chono::system_clock::time_point` a
timezone would be needed:
chono::system_clock::time_point instant =
dt.in_timezone(chrono::timezones::utc); // or perhaps `dt.in_utc()` for
short.

Best regards,
Anders Dalvander


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