Boost logo

Boost :

From: Justin Crites (pyxl_at_[hidden])
Date: 2002-04-13 16:02:58


As I understand it, one of the purposes of xtime is to represent durations
in time.

It seems to me that the present implementation of xtime on many platforms
relies upon the system's current time - this could change at any point! The
system time may be set backwards by the user or forwards by daylight saving'
s time, both which may result in code using xtime to receive incorrect time
durations.

Consider the following...

       boost::xtime xt;
       boost::xtime_get(&xt, boost::TIME_UTC);
       xt.sec += some_constant;

       // daylight saving's sets the system block backwards an hour

       boost::thread::sleep(xt);

       // our thread is now suspended for about an hour?

Would it not make more sense to always base durations in time upon something
which is always moving forward in time at a consistent rate, such as the
system uptime?

Justin Crites


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