Opened 13 years ago

Closed 13 years ago

#3345 closed Patches (fixed)

Support for gettimeofday() in high_resolution_timer.

Reported by: ej.grace@… Owned by: Hartmut Kaiser
Milestone: Boost 1.40.0 Component: None
Version: Boost Development Trunk Severity: Cosmetic
Keywords: high_resolution_timer gettimeofday() darwin Cc:

Description

On certain platforms, such as OS X (Darwin) util::high_resolution_timer ultimately defaults to using std::clock(). On this platform, and probably many others gettimeofday() is a reasonable, nominally microsecond precision, alternative.

Attached is a version which will make use of gettimeofday() if there are no alternatives and the existence of gettimeofday() is guaranteed by the macro BOOST_HAS_GETTIMEOFDAY.

Attachments (2)

high_resolution_timer.hpp (13.3 KB ) - added by ej.grace@… 13 years ago.
A patched version of high_resolution_timer.hpp that includes support for gettimeofday() if it exists in preference to boost::timer().
high_resolution_timer.2.hpp (14.5 KB ) - added by ej.grace@… 13 years ago.
Fixed update of the high_precision_timer - differences of unsigned integers are now explicitly mangaged.

Download all attachments as: .zip

Change History (5)

by ej.grace@…, 13 years ago

Attachment: high_resolution_timer.hpp added

A patched version of high_resolution_timer.hpp that includes support for gettimeofday() if it exists in preference to boost::timer().

comment:1 by ej.grace@…, 13 years ago

I have just noticed there are some subtle problems with this. I will review them and upload a new version.

comment:2 by anonymous, 13 years ago

Thanks! I committed a patched version anyway (I was faster than you :-P). But I'll update it as soon as you found a fix for the problems.

Regards Hartmut

by ej.grace@…, 13 years ago

Attachment: high_resolution_timer.2.hpp added

Fixed update of the high_precision_timer - differences of unsigned integers are now explicitly mangaged.

comment:3 by Hartmut Kaiser, 13 years ago

Resolution: fixed
Status: newclosed

The patch has been integrated

Note: See TracTickets for help on using tickets.