Main Page | Directories | File List | Globals | Related Pages

VideoWrapperTime.cpp File Reference

Implements time functions to support video wrappers. More...

#include "VideoWrapperTime.h"

Functions

int vw_gettimeofday (timeval *tp, struct timezone *tzp)
 Implementation of 'gettimeofday'.
timeval TimevalSum (const timeval &tv1, const timeval &tv2)
 Calculates the sum of tv1 and tv2.
timeval TimevalDiff (const timeval &tv1, const timeval &tv2)
 Calculates the diff between tv1 and tv2.
int TimevalGreater (const timeval &tv1, const timeval &tv2)
 Tests two timeval structures for a greater-than relationship.
int TimevalEqual (const timeval &tv1, const timeval &tv2)
 Tests two timeval structures for equality.
double TimevalMsecs (const timeval &tv)
 Converts a timeval structure to milliseonds.
timeval MsecsTimeval (const double dMsecs)
 Converts milliseconds to a timeval structure.


Detailed Description

Implements time functions to support video wrappers.

Most functions have been copied from VRPN. Copyright 2005, Georgia Tech Research Corporation, Atlanta, Georgia 30332-0415 All Rights Reserved


Function Documentation

timeval MsecsTimeval const double  dMsecs  ) 
 

Converts milliseconds to a timeval structure.

Parameters:
dMsecs Milliseconds.
Returns:
timeval equivalent to dMsecs.

timeval TimevalDiff const timeval &  tv1,
const timeval &  tv2
 

Calculates the diff between tv1 and tv2.

Returns the diff in a timeval struct. Calculates negative times properly, with the appropriate sign on both tv_sec and tv_usec (these signs will match unless one of them is 0)

Parameters:
tv1 a timeval structure.
tv2 another timeval structure.
Returns:
Returns diff of tv1 and tv2.

int TimevalEqual const timeval &  tv1,
const timeval &  tv2
 

Tests two timeval structures for equality.

Parameters:
tv1 a timeval structure.
tv2 another timeval structure.
Returns:
Returns 1 if tv1 is equal to tv2; 0 otherwise.

int TimevalGreater const timeval &  tv1,
const timeval &  tv2
 

Tests two timeval structures for a greater-than relationship.

Parameters:
tv1 a timeval structure.
tv2 another timeval structure.
Returns:
Returns 1 if tv1 is greater than tv2; 0 otherwise.

double TimevalMsecs const timeval &  tv  ) 
 

Converts a timeval structure to milliseonds.

Parameters:
tv a timeval structure.
Returns:
Milliseconds equivalent to tv.

timeval TimevalSum const timeval &  tv1,
const timeval &  tv2
 

Calculates the sum of tv1 and tv2.

Returns the sum in an timeval struct. Calculates negative times properly, with the appropriate sign on both tv_sec and tv_usec (these signs will match unless one of them is 0). NOTE: both abs(tv_usec)'s must be < 1000000 (ie, normal timeval format)

Parameters:
tv1 a timeval structure.
tv2 another timeval structure.
Returns:
Sub of tv1 and tv2.

int vw_gettimeofday timeval *  tp,
struct timezone *  tzp
 

Implementation of 'gettimeofday'.

Although VC++ doesn't include a gettimeofday call, Cygnus Solutions Cygwin32 environment does, so this is not used when compiling with gcc under WIN32.

Parameters:
[out] tp Pointer to a timeval structure receiving the current time.
[out] tzp Pointer to a timezon structure receiving the current time zone information.
Returns:
Returns 0 if successful.


Generated on Tue Oct 18 12:18:51 2005 for VideoWrapper API by  doxygen 1.4.1