OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
TimeValueC.h File Reference

Header defining a dependency-free, cross-platform substitute for struct timeval. More...

#include <osvr/Util/APIBaseC.h>
#include <osvr/Util/AnnotationMacrosC.h>
#include <osvr/Util/BoolC.h>
#include <osvr/Util/Export.h>
#include <osvr/Util/PlatformConfig.h>
#include <osvr/Util/StdInt.h>
#include <cassert>
#include <cmath>

Go to the source code of this file.

Classes

struct  OSVR_TimeValue
 Standardized, portable parallel to struct timeval for representing both absolute times and time intervals. More...
 

Typedefs

typedef int64_t OSVR_TimeValue_Seconds
 The signed integer type storing the seconds in a struct OSVR_TimeValue.
 
typedef int32_t OSVR_TimeValue_Microseconds
 The signed integer type storing the microseconds in a struct OSVR_TimeValue.
 
typedef struct OSVR_TimeValue OSVR_TimeValue
 Standardized, portable parallel to struct timeval for representing both absolute times and time intervals. More...
 

Functions

void osvrTimeValueGetNow (OSVR_TimeValue *dest)
 Gets the current time in the TimeValue. Parallel to gettimeofday.
 
void osvrTimeValueToStructTimeval (struct timeval *dest, const OSVR_TimeValue *src)
 Converts from a TimeValue struct to your system's struct timeval. More...
 
void osvrStructTimevalToTimeValue (OSVR_TimeValue *dest, const struct timeval *src)
 Converts from a TimeValue struct to your system's struct timeval. More...
 
void osvrTimeValueNormalize (OSVR_TimeValue *tv)
 "Normalizes" a time value so that the absolute number of microseconds is less than 1,000,000, and that the sign of both components is the same. More...
 
void osvrTimeValueSum (OSVR_TimeValue *tvA, const OSVR_TimeValue *tvB)
 Sums two time values, replacing the first with the result. More...
 
void osvrTimeValueDifference (OSVR_TimeValue *tvA, const OSVR_TimeValue *tvB)
 Computes the difference between two time values, replacing the first with the result. More...
 
int osvrTimeValueCmp (const OSVR_TimeValue *tvA, const OSVR_TimeValue *tvB)
 Compares two time values (assumed to be normalized), returning the same values as strcmp. More...
 
OSVR_EXTERN_C_END double osvrTimeValueDurationSeconds (const OSVR_TimeValue *tvA, const OSVR_TimeValue *tvB)
 Compute the difference between the two time values, returning the duration as a double-precision floating-point number of seconds. More...
 
OSVR_CBool osvrTimeValueGreater (const OSVR_TimeValue *tvA, const OSVR_TimeValue *tvB)
 True if A is later than B.
 
bool osvrTimeValueIsNormalized (const OSVR_TimeValue &tv)
 Returns true if the time value is normalized. Typically used in assertions.
 
bool osvrTimeValueGreater (const OSVR_TimeValue &tvA, const OSVR_TimeValue &tvB)
 True if A is later than B.
 
bool operator> (const OSVR_TimeValue &tvA, const OSVR_TimeValue &tvB)
 Operator > overload for time values.
 
bool operator< (const OSVR_TimeValue &tvA, const OSVR_TimeValue &tvB)
 Operator < overload for time values.
 
bool operator== (const OSVR_TimeValue &tvA, const OSVR_TimeValue &tvB)
 Operator == overload for time values.
 
bool operator!= (const OSVR_TimeValue &tvA, const OSVR_TimeValue &tvB)
 Operator == overload for time values.
 

Detailed Description

Header defining a dependency-free, cross-platform substitute for struct timeval.

Must be c-safe!

Date
2014
Author
Sensics, Inc. http://sensics.com/osvr

Definition in file TimeValueC.h.