time

Functions

tm_get_time

publicplat


Returns time since Epoch.
Guarantees millisecond precision

LIBEXPORT PLATAPI ts_time_t tm_get_time()

tm_get_clock

publicplat


Returns clock (monotonic time since some unspecified starting point)
Guarantees 100-nanosecond precision (Windows) or better (Unix)

LIBEXPORT PLATAPI ts_time_t tm_get_clock()

tm_get_clock_res

publicplat


Returns clock's resolution

LIBEXPORT PLATAPI ts_time_t tm_get_clock_res()

tm_diff

public

LIBEXPORT ts_time_t tm_diff(ts_time_t a, ts_time_t b)

tm_sleep_milli

publicplat


Sleep with millisecond precision

LIBEXPORT PLATAPI void tm_sleep_milli(ts_time_t t)

tm_sleep_nano

publicplat


Sleep with nanosecond precision

LIBEXPORT PLATAPI void tm_sleep_nano(ts_time_t t)

tm_ceil_diff

public


Ceils time tm with precision and returns difference between ceiled
value and original tm.

LIBEXPORT ts_time_t tm_ceil_diff(ts_time_t tm, ts_time_t precision)

tm_human_print

public


Prints seconds - nanoseconds in human-readable format
Recommended buffer size is 40

RETURN VALUES
0 if dst was not enough or number of printed characters

LIBEXPORT size_t tm_human_print(ts_time_t t, char* dst, size_t size)

tm_datetime_print

public


Prints date-time in nice format (%H:%M:%S %d.%m.%Y)

LIBEXPORT size_t tm_datetime_print(ts_time_t t, char* dst, size_t size)

Types


64-bit integer is enough to keep time up to XXIIIth century
with nanosecond precision. I hope, that we will release patch until then.

typedef int64_t ts_time_t;