clocks, sleeping and calendar time (UTC only: there are no time zones, so local time is UTC).
More...
Go to the source code of this file.
|
| time_t | time (time_t *out) |
| int | clock_gettime (clockid_t id, struct timespec *out) |
| int | timespec_get (struct timespec *out, int base) |
| | the time now (C11).
|
| int | clock_settime (clockid_t id, const struct timespec *when) |
| | set the realtime clock (root only; whole seconds)
|
| int | nanosleep (const struct timespec *span, struct timespec *left) |
| clock_t | clock (void) |
| double | difftime (time_t end, time_t start) |
| struct tm * | gmtime_r (const time_t *t, struct tm *out) |
| struct tm * | gmtime (const time_t *t) |
| struct tm * | localtime_r (const time_t *t, struct tm *out) |
| struct tm * | localtime (const time_t *t) |
| time_t | timegm (struct tm *tm) |
| time_t | mktime (struct tm *tm) |
| char * | asctime_r (const struct tm *tm, char *buf) |
| char * | asctime (const struct tm *tm) |
| char * | ctime (const time_t *t) |
| size_t | strftime (char *buf, size_t size, const char *format, const struct tm *tm) |
| | format a time.
|
| char * | strptime (const char *restrict text, const char *restrict format, struct tm *restrict tm) |
| | read a time from text as format says (the strftime conversions, and spaces in the format match any spaces) into the fields of tm it names.
|
clocks, sleeping and calendar time (UTC only: there are no time zones, so local time is UTC).
struct timespec and the clock ids are ABI (src/kernel/time/clock.h).
◆ NULL
◆ CLOCK_REALTIME
◆ CLOCK_MONOTONIC
| #define CLOCK_MONOTONIC 1 |
◆ CLOCK_PROCESS_CPUTIME_ID
| #define CLOCK_PROCESS_CPUTIME_ID 2 |
◆ CLOCKS_PER_SEC
| #define CLOCKS_PER_SEC 1000000l |
◆ TIME_UTC
◆ clockid_t
◆ time()
◆ clock_gettime()
◆ timespec_get()
| int timespec_get |
( |
struct timespec * | out, |
|
|
int | base ) |
the time now (C11).
- Returns
- base (TIME_UTC), or 0 for another base.
◆ clock_settime()
set the realtime clock (root only; whole seconds)
◆ nanosleep()
◆ clock()
◆ difftime()
◆ gmtime_r()
| struct tm * gmtime_r |
( |
const time_t * | t, |
|
|
struct tm * | out ) |
◆ gmtime()
◆ localtime_r()
| struct tm * localtime_r |
( |
const time_t * | t, |
|
|
struct tm * | out ) |
◆ localtime()
| struct tm * localtime |
( |
const time_t * | t | ) |
|
◆ timegm()
◆ mktime()
◆ asctime_r()
| char * asctime_r |
( |
const struct tm * | tm, |
|
|
char * | buf ) |
◆ asctime()
| char * asctime |
( |
const struct tm * | tm | ) |
|
◆ ctime()
| char * ctime |
( |
const time_t * | t | ) |
|
◆ strftime()
| size_t strftime |
( |
char * | buf, |
|
|
size_t | size, |
|
|
const char * | format, |
|
|
const struct tm * | tm ) |
format a time.
supports a A b B c d e H I j m M n p S t u w y Y Z z F T D R and %%.
- Returns
- the length written, or 0 if it does not fit.
◆ strptime()
| char * strptime |
( |
const char *restrict | text, |
|
|
const char *restrict | format, |
|
|
struct tm *restrict | tm ) |
read a time from text as format says (the strftime conversions, and spaces in the format match any spaces) into the fields of tm it names.
- Returns
- the first character not read, or NULL when the text does not fit.