Utility class to manage and synchronize Server Time from the Backend services.
More...
#include <AccelByteTimeManager.h>
|
|
| FAccelByteTimeManager (AccelByte::FHttpRetrySchedulerBase &InHttpRef, FString const &InBasicServerUrl) |
|
| FAccelByteTimeManager (const FString &InBasicServerUrl) |
|
virtual void | Reset () |
| | Reset any cached Server Time in the Time Manager.
|
| virtual FAccelByteTaskWPtr | GetServerTime (THandler< FTime > const &OnSuccess, FErrorHandler const &OnError, bool bForceSync=false) |
| | Get current Server Time based on the back calculation from the cached Server Time value, or sync with the Backend services if the cached Server Time is out of sync and store it to the cache.
|
| virtual FDateTime | GetCachedServerTime () const |
| | Get cached Server Time value, if there is no cached Server Time then return 1970-01-01 00:00:00.
|
| virtual FDateTime | GetCurrentServerTime () |
| | Get current Server Time value based on back calculation from the cached Server Time value, if there is no cached Server Time value then return 1970-01-01 00:00:00.
|
| virtual bool | IsInSync () |
| | Check whether the time manager is in sync with server time or not.
|
|
| virtual FTimespan | BackCalculateServerTime () |
| | Back calculate current Server Time from the last time when the Server Time is sync'd.
|
Utility class to manage and synchronize Server Time from the Backend services.
◆ BackCalculateServerTime()
| FTimespan AccelByte::FAccelByteTimeManager::BackCalculateServerTime |
( |
| ) |
|
|
protectedvirtual |
Back calculate current Server Time from the last time when the Server Time is sync'd.
- Returns
- The timespan from the last time the Server Time is sync'd in FTimespan.
◆ GetCachedServerTime()
| FDateTime AccelByte::FAccelByteTimeManager::GetCachedServerTime |
( |
| ) |
const |
|
virtual |
Get cached Server Time value, if there is no cached Server Time then return 1970-01-01 00:00:00.
- Returns
- Cached Server Time in FDateTime
◆ GetCurrentServerTime()
| FDateTime AccelByte::FAccelByteTimeManager::GetCurrentServerTime |
( |
| ) |
|
|
virtual |
Get current Server Time value based on back calculation from the cached Server Time value, if there is no cached Server Time value then return 1970-01-01 00:00:00.
- Returns
- Current Server Time in FDateTime.
◆ GetServerTime()
| FAccelByteTaskWPtr AccelByte::FAccelByteTimeManager::GetServerTime |
( |
THandler< FTime > const & | OnSuccess, |
|
|
FErrorHandler const & | OnError, |
|
|
bool | bForceSync = false ) |
|
virtual |
Get current Server Time based on the back calculation from the cached Server Time value, or sync with the Backend services if the cached Server Time is out of sync and store it to the cache.
- Parameters
-
| OnSuccess | Success delegate. |
| OnError | Error delegate |
| bForceSync | Flag to forcefully sync the Server Time with the Backend services. |
- Returns
- AccelByteTask object to track and cancel the ongoing API operation.
◆ IsInSync()
| bool AccelByte::FAccelByteTimeManager::IsInSync |
( |
| ) |
|
|
virtual |
Check whether the time manager is in sync with server time or not.
- Returns
- True if the time manager is in sync with server time.