#include <osaTimeServer.h>
Inheritance diagram for osaTimeServer:


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.
| osaTimeServer::osaTimeServer | ( | ) |
Default constructor.
| osaTimeServer::~osaTimeServer | ( | ) |
Destructor
| 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.
| origin | Returns the current origin |
| double osaTimeServer::GetRelativeTime | ( | void | ) | const |
Get the number of seconds that have elapsed since the time origin.
| 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.
| 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.
| absolute | The absolute time value (input) |