Namespaces | Defines | Functions | Variables

_src_base_time_clock.cc File Reference

System-specific time functions. More...

#include "base/module.hh"
#include "base/conf.hh"
#include "base/stream.hh"
#include "base/time.hh"
#include "base/time_clock.hh"

Namespaces

namespace  base
 

Library of base code.


Defines

#define BASE_TIME_CLOCK_CC   1

Functions

const Milliseconds base::TIME_CLOCK_ADEQUATE_TIMER_MILLISECONDS (1000/TIME_CLOCK_DESIRED_HZ)
 reject timer that is less frequent
const Milliseconds base::TICK_CLOCK_CORRECTED_DELTA_MILLISECONDS (1000/TIME_CLOCK_DESIRED_HZ)
 artificial time-delta if calendar-clock was skewed
INTERN Milliseconds base::ComputeElapsedTimeFromCounter (const Milliseconds startMilliseconds, const Milliseconds currentMilliseconds)
INTERN void base::PrintErrorTimeDelta (const Milliseconds deltaMilliseconds)
INTERN Milliseconds base::CorrectClockSkew (const Milliseconds delta)

Variables

const uint base::TIME_CLOCK_DESIRED_HZ = 100
 desired frequency/Hz

Detailed Description

System-specific time functions.

LastChangedDate:
2011-04-23 21:07:07 -0400 (Sat, 23 Apr 2011)
Author:
Jim E. Brooks http://www.palomino3d.org
 * -----------------------------------------------------------------------------
 * Notes:
 * - Two ways to measure time on a computer are counters and clocks.
 *   Counters are preferred since clocks are vulnerable skew from time adjustments.
 * - 64-bits of milliseconds can define 300 million years (less than FreeBSD's uptime).
 * - Counters (and the program) will stop while the system sleeps, of course.
 * - The counters used here are 64-bits and supposedly will never overflow.
 *   A possibility is a bad implementation that uses a hardware counter with less bits
 *   and the OS doesn't correct overflow (kind of OS bug that should be noticed and fixed).
 * - GetCurrentTime() is a macro in Windows, hence the long name GetCurrentMilliseconds().
 * -----------------------------------------------------------------------------
 * POSIX:
 * How to test POSIX features at compile-time:
 * #if POSIX_FLAG >= 0  // WRONG: if POSIX_FLAG is undefined preprocessor
 *                      // defaults it as 0 so test incorrectly becomes true.
 * man sysconf:
 * "For options, typically, there is a  constant  _POSIX_FOO  that  may  be
 * defined in <unistd.h>.  If it is undefined, one should ask at run time.
 * If it is defined to -1, then the option is not supported.   If it is
 * defined to 0, then relevant functions and headers exist, but one has to
 * ask at runtime what degree of support is available.  If it is defined
 * to a value other than -1 or 0, then the option is supported."
 * -----------------------------------------------------------------------------
 * 

Define Documentation

#define BASE_TIME_CLOCK_CC   1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Palomino Flight Simulator documents generated by doxygen 1.7.1 on Tue May 15 2012 22:40:10