A Time Synchronizer acts as either a timer server or a time client.
More...
#include <time.h>
List of all members.
Public Member Functions |
| Synchronizer () |
| Constructor.
|
virtual | ~Synchronizer () |
| Destructor.
|
bool | Start (const bool server, const unsigned short port, const IP4Address &multicastGroup, const unsigned int udelay=1) |
| Creates a time synchronizer in either server mode or client.
|
void | Stop () |
| Stops the synchronizer.
|
Static Protected Member Functions |
static void | ServerThread (void *args) |
| Thread for sending or receiving synchronized time data.
|
Protected Attributes |
void * | mpThreadObject |
| Thread data object.
|
Socket * | mpSocket |
| Socket data.
|
unsigned int | mDelayUs |
| Delay in ms. Changes based on hardware capabilities.
|
Detailed Description
A Time Synchronizer acts as either a timer server or a time client.
If created in server mode, the Synchronizer will continuosly transmit at UTC time at high speed over the network to a multicast address so that clients on other computers can use that value is the system time for applications using this library (CxUtils).
If initialized in client mode, the client attempts to receive time data being transmitted by a Synchronizer server. If data is available, the Time methods in this fill will return the time values received by the server, synchronizing time between multiple computers.
Definition at line 191 of file time.h.
Constructor & Destructor Documentation
Time::Synchronizer::Synchronizer |
( |
) |
|
Time::Synchronizer::~Synchronizer |
( |
) |
[virtual] |
Member Function Documentation
void Time::Synchronizer::ServerThread |
( |
void * |
args ) |
[static, protected] |
Thread for sending or receiving synchronized time data.
Definition at line 727 of file time.cpp.
bool Time::Synchronizer::Start |
( |
const bool |
server, |
|
|
const unsigned short |
port, |
|
|
const IP4Address & |
multicastGroup, |
|
|
const unsigned int |
udelay = 1 |
|
) |
| |
Creates a time synchronizer in either server mode or client.
- Parameters:
-
[in] | server | If true, creates a thread which multicasts UTC time data. If false, thread tries to receive synchronized time being transmitted. |
[in] | port | Port to use. |
[in] | multicastGroup | Multicast group to use. |
[in] | udelay | By default, there is a minimum of a 1 micro-second delay (Linux only) between reading of system time to prevent over-use of CPU. However, on some systems you may want to turn this off if you don't care or they system is slow and cannot process quickly enough with a delay. To turn off, set to 0. |
- Returns:
- True on success, false on failure.
Definition at line 667 of file time.cpp.
void Time::Synchronizer::Stop |
( |
) |
|
Stops the synchronizer.
Definition at line 710 of file time.cpp.
Member Data Documentation
Delay in ms. Changes based on hardware capabilities.
Definition at line 205 of file time.h.
The documentation for this class was generated from the following files:
- C:/Active/libraries/cxutils/2.0/include/cxutils/time.h
- C:/Active/libraries/cxutils/2.0/src/cxutils/time.cpp