Skip to content

Time

Ioto provides a suite of time management routines to help format, parse and manage time values.

Ioto stores calendar time in Time values that store the date/time as elapsed milliseconds since Jan 1, 1970. Time values may go backwards if the system date clock is adjusted.

Ioto stores system time in Ticks values that are a system representation of elapsed time in milliseconds. Ticks will never go backwards even if the system date clock is adjusted.

API Tour

To get the current time:

1
Time time = rGetTime();

To get the current time in ticks:

1
Ticks ticks = rGetTicks()

To get a high resolution CPU tick counter on some systems:

1
uint64 rGetHiResTicks();

To convert the time to a string local time representation:

1
char *str = rFormatLocalTime("%a %b %d %T %Y %Z", time);

To convert to universal time:

1
char *str = rFormatUniversalTime("%FT%TZ", time);

To get a local string representation of the current date:

1
char *str = rGetDate(NULL);

To get an ISO format date:

1
char *str = rGetIsoDate(time);

To get the elapsed time since a prior measurement:

1
Ticks elapsed = rGetElapsedTicks(mark);

To get the remaining ticks until a timeout:

1
Ticks remaining = rGetRemainingTicks(mark, timeout);

To parse an ISO date string:

1
Time time = rParseIsoDate(isoDateString);

API Reference

The full API is specified here:

Time API