SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
TimeUtil.h File Reference

Doxygen only documents namespace-scope entities (enums, aliases, constants, free functions) in a header that carries this block. More...

#include <chrono>
#include <cstdint>

Functions

int64_t sfs3::util::currentMillis ()
 Returns the current time as milliseconds since the Unix epoch.
int64_t sfs3::util::nanoTime ()
 Monotonic high-resolution timer, mirroring Java's System.nanoTime().

Detailed Description

Doxygen only documents namespace-scope entities (enums, aliases, constants, free functions) in a header that carries this block.

Function Documentation

◆ currentMillis()

int64_t sfs3::util::currentMillis ( )
inline

Returns the current time as milliseconds since the Unix epoch.

It reads the wall clock, so the value can jump backwards or forwards when the system clock is corrected. Use it for timestamps only; to measure an interval use a steady clock instead.

Returns
the milliseconds elapsed since 1 January 1970, UTC

◆ nanoTime()

int64_t sfs3::util::nanoTime ( )
inline

Monotonic high-resolution timer, mirroring Java's System.nanoTime().

Returns a nanosecond count from an arbitrary, fixed origin. Only the difference between two calls is meaningful; the absolute value has no relation to wall-clock time or any epoch. Use for measuring elapsed intervals, never for timestamps – for those use currentMillis().

Returns
nanoseconds since an unspecified but steady origin