Table of Contents

Class ServerTimeModule

Namespace
Titipi.MocaLib

Fetches the current UTC time from the Titipi server API and exposes it as UtcNow. Resynchronizes every 10 minutes; uses a cached value from PlayerPrefs on cold starts so the time is available immediately without waiting for the first network round-trip.

public static class ServerTimeModule
Inheritance
ServerTimeModule
Inherited Members

Properties

IsInitialized

Whether the module has fetched (or loaded from cache) a valid server time.

UtcNow

The current UTC time, derived by offsetting the last fetched server time by the elapsed real time since that fetch. Falls back to UtcNow and logs a warning if not yet initialized.

Initialization

Initialize()

Starts the server time sync loop. Immediately resolves from the PlayerPrefs cache if available, otherwise waits for the first successful network fetch before returning true.

Events

OnServerTimeReady

Fired when the server time is first available, either from cache or a successful network fetch.