ERC CISST - cisst software

osaTimeServer Class Reference
[OS Abstraction]

#include <osaTimeServer.h>

Inheritance diagram for osaTimeServer:

Inheritance graph
[legend]
Collaboration diagram for osaTimeServer:

Collaboration graph
[legend]
List of all members.

Detailed Description

Class for relative time.

The osaRelativeTime class is used to manage the relationship between relative and absolute time. Specifically, the GetRelativeTime method returns the number of seconds that have elapsed since the time origin was set (via a call to SetTimeOrigin).

Although it might seem possible to implement this class without OS dependencies (e.g., by using osaGetAbsoluteTime), this is problematic on some platforms, such as Windows, where it is necessary to synchronize multiple time sources to get a high resolution time that is relative to an absolute time. Also, even on non-Windows platforms, it would not have been as efficient because the native (OS-specific) "absolute time" structure would have to converted to an osaAbsoluteTime structure for every call to GetRelativeTime.

This class has significant overlap with osaStopwatch.

Definition at line 63 of file osaTimeServer.h.

Public Member Functions


Constructor & Destructor Documentation

osaTimeServer::osaTimeServer (  ) 

Default constructor.

osaTimeServer::~osaTimeServer (  ) 

Destructor


Member Function Documentation

void osaTimeServer::SetTimeOrigin ( void   ) 

Set the time origin for the relative time measurements to "now". Subsequent calls to GetRelativeTime will return the number of seconds that have elaspsed since this call was made.

bool osaTimeServer::GetTimeOrigin ( osaAbsoluteTime origin  )  const

Get the time origin that is in effect for the relative time measurements.

Parameters:
origin Returns the current origin

double osaTimeServer::GetRelativeTime ( void   )  const

Get the number of seconds that have elapsed since the time origin.

Returns:
The number of seconds

double osaTimeServer::EstimateDrift ( void   )  const

Estimate drift between synchronized clocks (Windows only)

void osaTimeServer::RelativeToAbsolute ( double  relative,
osaAbsoluteTime absolute 
) const

Convert the specified relative time (in seconds) to an absolute time by adding it to the time origin.

Parameters:
relative The relative time value in seconds (input)
absolute The absolute time value (output)

double osaTimeServer::AbsoluteToRelative ( const osaAbsoluteTime absolute  )  const

Convert the specified absolute time to a relative time by subtracting from the time origin and converting to seconds.

Parameters:
absolute The absolute time value (input)
Returns:
The relative time value in seconds


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu