Boost logo

Boost :

Subject: Re: [boost] [filesystem] Epoch of trivial_clock
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2014-08-22 14:11:41


On 22/08/2014 08:10 a.m., Bjorn Reese wrote:
> The filesystem::trivial_clock type is implementation-defined [1]. That
> means that the epoch is also implementation-defined.
>
> How do we determine the epoch of trivial_clock?

Given a clock `C`, a default constructed `C::time_point` (or any
instantiation of `time_point` for the clock `C`) represents the epoch of
the clock. That is, for such a `time_point`, `time_since_epoch()` will
return a duration of 0.

That is somewhat obvious, the epoch is the origin, and unlikely to help
your use case.

> For instance, we may need to represent the last_write_time() timestamp
> to the end-user, or transfer it to another node when we implement a
> network file system.

It seems to me that what you need instead is to map a `time_point` from
one clock to another, one that has an epoch under your control. That
time_point could be the epoch of a clock. That is roughly done with:

   tp2 = C2::now() + (tp1 - C1::now())

Regards,

-- 
Agustín K-ballo Bergé.-
http://talesofcpp.fusionfenix.com

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