#include <libcork/core.h>
A high-precision timestamp type. A timestamp is represented by a 64-bit integer, whose unit is the gammasecond (γsec), where \(1~\textrm{γsec} = \frac{1}{2^{32}} \textrm{sec}\). With this representation, the upper 32 bits of a timestamp value represent the timestamp truncated (towards zero) to seconds.
For this type, we don’t concern ourselves with any higher-level issues of clock synchronization or time zones. cork_timestamp values can be used to represent any time quantity, regardless of which time standard (UTC, GMT, TAI) you use, or whether it takes into account the local time zone.
Initializes a timestamp from a separate seconds part and fractional part. For the _sec variant, the fractional part will be set to 0. For the _gsec variant, you provide the fractional part in gammaseconds. For the _msec, _usec, and _nsec variants, the fractional part will be translated into gammaseconds from milliseconds, microseconds, or nanoseconds, respectively.
Initializes a timestamp with the current UTC time of day.
Note
The resolution of this function is system-dependent.
Returns the seconds portion of a timestamp.
Returns the fractional portion of a timestamp. The variants return the fractional portion in, respectively, gammaseconds, milliseconds, microseconds, or nanoseconds.
Fills in buf with the string representation of the given timestamp, according to fmt, which should be a format string compatible with the POSIX strftime function. size must be the size (in bytes) of buf. If we can’t format the timestamp for any reason, we return false. The _utc variant assumes that ts represents a UTC time, whereas teh _local variant assumes that it represents a time in the local time zone.