![]() |
Classes | |
class | tk11::Precision_Clock |
A clock which measures the current system time. More... | |
class | tk11::Secondary_Clock |
A secondary clock which is driven by an input clock. More... | |
Typedefs | |
typedef boost::posix_time::ptime | tk11::Time |
Time value type. | |
typedef boost::posix_time::time_duration | tk11::Duration |
Time duration type. | |
Functions | |
template<typename Int > | |
Int | tk11::time_div_int (const Duration &t1, const Duration &t2) |
Integer division of time durations. | |
template<typename Float > | |
Float | tk11::time_div_float (const Duration &t1, const Duration &t2) |
Floating-point division of time durations. |
Provides definitions of types for representing time. These types are actually implemented in Boost.Date_Time. See http://www.boost.org/doc/libs/1_42_0/doc/html/date_time.html for more information. Also provides helper functions for dividing time duration values.
Two classes are provided for implementing high-precision timing for animation and simulation: Precision_Clock returns high precision time, and Secondary_Clock provides a clock which can be paused (e.g. when an application does not have the focus or when a game is paused).
Float tk11::time_div_float | ( | const Duration & | t1, | |
const Duration & | t2 | |||
) | [inline] |
Floating-point division of time durations.
Divides a time duration value by another, returning a floating point result. The conversion from ticks to the integer type is performed before the division. The floating point type is a template parameter.
Example:
const double pi = 3.1415926535; Duration elapsed_time, period; double angle = time_div_float<double>(elapsed_time, period) * 2 * pi;
t1 | Dividend | |
t2 | Divisor |
Int tk11::time_div_int | ( | const Duration & | t1, | |
const Duration & | t2 | |||
) | [inline] |
Integer division of time durations.
Divides a time duration value by another, returning an integer result. The conversion from ticks to the integer type is performed after the division. The integer type is a template parameter.
Example:
Duration total_duration, run_duration; int number_of_runs = time_div_int<int>(total_duration, run_duration);
t1 | Dividend | |
t2 | Divisor |