This class provide a independant universal time system. More...
#include <unitime.h>
Inherits NLMISC::CTime.
Static Public Member Functions | |
| static NLMISC::TTime | getUniTime () |
| Return the time in millisecond. This time is the same on all computers at the same moment. | |
| static const char * | getStringUniTime () |
| Return the time in a string format to be display. | |
| static const char * | getStringUniTime (NLMISC::TTime ut) |
| Return the time in a string format to be display. | |
| static void | syncUniTimeFromService (CCallbackNetBase::TRecordingState rec=CCallbackNetBase::Off, const CInetAddress *addr=NULL) |
| You need to call this function before calling getUniTime or an assert will occured. | |
| static void | installServer (CCallbackServer *server) |
| Call this function in the init part of the front end service to enable time syncro between shard and clients. | |
| static void | syncUniTimeFromServer (CCallbackClient *client) |
| Call this functions in the init part of the client side to synchronize between client and shard. | |
| static void | setUniTime (NLMISC::TTime uTime, NLMISC::TTime lTime) |
| static void | setUniTime (NLMISC::TTime uTime) |
| static void | simulate () |
| Call this method before to prevent syncUniTimeFromService() from real synchronization: syncUniTimeFromService() will still communicate with the time service, as usual, but the local time will not be synchronized. | |
Static Public Attributes | |
| static bool | Sync = false |
Static Private Attributes | |
| static NLMISC::TTime | _SyncUniTime = 0 |
| static NLMISC::TTime | _SyncLocalTime = 0 |
| static bool | _Simulate = false |
This class provide a independant universal time system.
THIS CLASS IS DEPRECATED, DON'T USE IT
Definition at line 49 of file unitime.h.
| static const char* NLNET::_CUniTime::getStringUniTime | ( | NLMISC::TTime | ut | ) | [static] |
Return the time in a string format to be display.
| const char * NLNET::_CUniTime::getStringUniTime | ( | ) | [static] |
Return the time in a string format to be display.
Definition at line 87 of file unitime.cpp.
References getUniTime(), and nlstop.
| TTime NLNET::_CUniTime::getUniTime | ( | ) | [static] |
Return the time in millisecond. This time is the same on all computers at the same moment.
Definition at line 74 of file unitime.cpp.
References nlstop.
Referenced by NLNET::cbServerAskUniversalTime(), and getStringUniTime().
| void NLNET::_CUniTime::installServer | ( | CCallbackServer * | server | ) | [static] |
Call this function in the init part of the front end service to enable time syncro between shard and clients.
Definition at line 279 of file unitime.cpp.
References NLNET::CCallbackNetBase::addCallbackArray(), nlassert, nlstop, and NLNET::ServerTimeServiceCallbackArray.
| void NLNET::_CUniTime::setUniTime | ( | NLMISC::TTime | uTime | ) | [static] |
Definition at line 66 of file unitime.cpp.
References nlstop.
| void NLNET::_CUniTime::setUniTime | ( | NLMISC::TTime | uTime, | |
| NLMISC::TTime | lTime | |||
| ) | [static] |
Definition at line 47 of file unitime.cpp.
References nlstop.
| static void NLNET::_CUniTime::simulate | ( | ) | [inline, static] |
Call this method before to prevent syncUniTimeFromService() from real synchronization: syncUniTimeFromService() will still communicate with the time service, as usual, but the local time will not be synchronized.
| void NLNET::_CUniTime::syncUniTimeFromServer | ( | CCallbackClient * | client | ) | [static] |
Call this functions in the init part of the client side to synchronize between client and shard.
client is the connection between the client and the front end. The connection must be established before calling this function.
Definition at line 315 of file unitime.cpp.
References nlstop.
| void NLNET::_CUniTime::syncUniTimeFromService | ( | CCallbackNetBase::TRecordingState | rec = CCallbackNetBase::Off, |
|
| const CInetAddress * | addr = NULL | |||
| ) | [static] |
You need to call this function before calling getUniTime or an assert will occured.
This function will connect to the time service and synchronize your computer. This function assumes that all services run on server that are time synchronized with NTP for example. If addr is NULL, the function will connect to the Time Service via the Naming Service. In this case, the CNamingClient must be connected to a Naming Service. This function can be called *ONLY* by services that are inside of the shard. Don't use it for a client or a service outside of the shard.
Definition at line 156 of file unitime.cpp.
References nlstop.
bool NLNET::_CUniTime::_Simulate = false [static, private] |
Definition at line 105 of file unitime.h.
Referenced by simulate().
TTime NLNET::_CUniTime::_SyncLocalTime = 0 [static, private] |
TTime NLNET::_CUniTime::_SyncUniTime = 0 [static, private] |
bool NLNET::_CUniTime::Sync = false [static] |
1.6.1