|
Boost Users : |
Subject: Re: [Boost-users] [boost][chrono] time_since_epoch different on windows and linux
From: Klaim - Joël Lamotte (mjklaim_at_[hidden])
Date: 2011-12-08 16:57:58
Hi,
The documentation makes clear that epoch is implementation dependent :
"The library leaves epochs unspecified."
>From : http://www.boost.org/doc/libs/1_48_0/doc/html/chrono.html
"In each of the examples above, a different epoch is implied. Sometimes
an epoch has meaning for several millennia. Other times the meaning of an
epoch is lost after a while (such as the start of a timer, or when the
computer booted). However, if two
time_point<http://www.boost.org/doc/libs/1_48_0/doc/html/chrono/reference.html#chrono.reference.cpp0x.time_point_hpp.time_point>s
are known to share the same epoch, they can be subtracted, yielding a valid
duration<http://www.boost.org/doc/libs/1_48_0/doc/html/chrono/reference.html#chrono.reference.cpp0x.duration_hpp.duration>,
even if the definition of the epoch no longer has meaning.
In *Boost.Chrono*, an epoch is a purely abstract and unspecified concept.
There is no type representing an epoch. It is simply an idea that relates
(or doesn't) time_point<http://www.boost.org/doc/libs/1_48_0/doc/html/chrono/reference.html#chrono.reference.cpp0x.time_point_hpp.time_point>s
to a clock, and in the case that they share a clock,
time_point<http://www.boost.org/doc/libs/1_48_0/doc/html/chrono/reference.html#chrono.reference.cpp0x.time_point_hpp.time_point>s
to one another.
time_point<http://www.boost.org/doc/libs/1_48_0/doc/html/chrono/reference.html#chrono.reference.cpp0x.time_point_hpp.time_point>s
associated with different clocks are generally not interoperable unless the
relationship between the epochs associated with each clock is known."
>From http://www.boost.org/doc/libs/1_48_0/doc/html/chrono/users_guide.html
My understanding is that chrono isn't meant to provide absolute time
"position", but time measurement and manipulations.
The difference being that epoch is an arbitrary referential used to allow
now() to be written and worked with.
Joël Lamotte
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net