Time and Clocks
[Utilities]

Collaboration diagram for Time and Clocks:

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.

Detailed Description

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


Function Documentation

template<typename Float >
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;
Parameters:
t1 Dividend
t2 Divisor
Returns:
Quotient as floating-point value
See also:
time_div_int
template<typename Int >
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);
Parameters:
t1 Dividend
t2 Divisor
Returns:
Quotient as integer
See also:
time_div_float
Tk11 Direct3D 11 Toolkit version 0.2 (SourceForge)
Copyright Florian Winter 2010 - 2010. Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Generated on Sun Apr 11 20:23:01 2010 for Tk11 by  doxygen 1.6.3