Boost logo

Boost :

Subject: [boost] [thrad] #3179 Sleep with local_time
From: Vicente Botet Escriba (vicente.botet_at_[hidden])
Date: 2009-11-25 08:53:54


Hi,

Anthony this ticket have a simple solution.
https://svn.boost.org/trac/boost/ticket/3179

Nest follows my contents

Replying to anonymous:

    When calling sleep with an absolute time, it sleeps about two hours
instead of one second in code similar to the below example. ptime now =
second_clock::local_time(); this_thread::sleep( now + second(1) )

After a lot of headache I think that might is due to a missmatch with utc
and local time. Please make it possible to sleep until a "local time" (local
time zone) and write something about it in the documentations, I haven't
found anything special about which type of time should be used.
  Changed 5 days ago by viboes ¶

The this_thread::sleep prototype is

    template<typename TimeDuration>
    void sleep(TimeDuration const& rel_time);

The TimeDuration? you can pass as parameter must be one for which
system_time+TimeDuration? is defined.

You are right that this should be documented. BTW the interface for
thread::sleep is

    void thread::sleep(system_time const& abs_time);

Anthony, to be coherent, shouldn't you add the absolute time interface on
the namespace this_thread? Waiting fro Boost.Chrono, what about adding

void sleep(system_time const& abs_time);
void sleep_until(system_time const& abs_time);
template <class TimeDuration>
void sleep_for(TimeDuration const& rel_time);

Best,
Vicente

-- 
View this message in context: http://old.nabble.com/-thrad---3179--%09-Sleep-with-local_time-tp26513016p26513016.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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