Opened 13 years ago
Closed 12 years ago
#3179 closed Bugs (fixed)
Sleep with local_time
Reported by: | anonymous | Owned by: | Anthony Williams |
---|---|---|---|
Milestone: | Boost 1.40.0 | Component: | thread |
Version: | Boost 1.39.0 | Severity: | Problem |
Keywords: | sleep time | Cc: |
Description
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) )
Change History (4)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
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);
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Updated documentation on trunk.
Replying to anonymous:
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.