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


Anthony this ticket have a simple solution.

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);


View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at