![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Common time functions. More...
#include "nilorea/n_time.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>Go to the source code of this file.
Data Structures | |
| struct | _n_civil |
Functions | |
| static void | _civil_from_days (long long z, long long *y, unsigned *m, unsigned *d) |
| static int | _civil_of (time_t t, long offset, _n_civil *c) |
| static int | _civil_to_time (long long y, unsigned mo, unsigned d, unsigned h, unsigned mi, unsigned se, time_t *t) |
| static long long | _days_from_civil (long long y, unsigned m, unsigned d) |
| static int | _digits (const char *s, size_t n, unsigned *v) |
| static int | _leap (long long y) |
| static unsigned | _month_days (long long y, unsigned m) |
| static int | _offset_ok (long offset) |
| time_t | get_msec (N_TIME *timer) |
| Poll any N_TIME HiTimer, returning msec, and moving currentTime to startTime. | |
| time_t | get_sec (N_TIME *timer) |
| Poll any N_TIME HiTimer, returning sec, and moving currentTime to startTime. | |
| time_t | get_usec (N_TIME *timer) |
| Poll any N_TIME HiTimer, returning usec, and moving currentTime to startTime. | |
| int | n_time_http_date (time_t t, char *out, size_t size) |
| format t as an HTTP date (RFC 9110 IMF-fixdate, always GMT) | |
| int | n_time_parse_http_date (const char *s, size_t len, time_t *t) |
| parse an IMF-fixdate HTTP date strictly | |
| int | n_time_parse_rfc3339 (const char *s, size_t len, time_t *t) |
| parse "YYYY-MM-DD[T| ]HH:MM:SS[Z|+hh:mm|-hh:mm]" (UTC without a zone) | |
| int | n_time_rfc2822 (time_t t, long offset, char *out, size_t size) |
| format t as an RFC 2822 date at offset seconds east of UTC | |
| int | n_time_rfc3339 (time_t t, long offset, char *out, size_t size) |
| format t as RFC 3339 at offset seconds east of UTC ("+00:00" for UTC) | |
| void | PAUSE (void) |
| make a pause in a terminal | |
| int | start_HiTimer (N_TIME *timer) |
| Initialize or restart from zero any N_TIME HiTimer. | |
| void | u_sleep (unsigned int usec) |
| wrapper around usleep for API consistency | |
Variables | |
| static const char *const | _month_names [12] |
| static const char *const | _wday_names [7] = {"Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed"} |
| struct _n_civil |
|
static |
Definition at line 179 of file n_time.c.
Referenced by _civil_of().
|
static |
Definition at line 212 of file n_time.c.
References _civil_from_days(), _n_civil::hour, _n_civil::mday, _n_civil::min, _n_civil::mon, _n_civil::sec, _n_civil::wday_idx, and _n_civil::year.
Referenced by n_time_http_date(), n_time_parse_http_date(), n_time_rfc2822(), and n_time_rfc3339().
|
static |
Definition at line 295 of file n_time.c.
References _days_from_civil(), _month_days(), and h().
Referenced by n_time_parse_http_date(), and n_time_parse_rfc3339().
|
static |
Definition at line 168 of file n_time.c.
Referenced by _civil_to_time().
|
static |
Definition at line 283 of file n_time.c.
Referenced by n_time_parse_http_date(), and n_time_parse_rfc3339().
|
static |
Definition at line 197 of file n_time.c.
Referenced by _month_days().
|
static |
Definition at line 201 of file n_time.c.
References _leap().
Referenced by _civil_to_time().
|
static |
Definition at line 226 of file n_time.c.
Referenced by n_time_rfc2822(), and n_time_rfc3339().
|
static |
Definition at line 194 of file n_time.c.
Referenced by n_time_http_date(), n_time_parse_http_date(), and n_time_rfc2822().
|
static |
Definition at line 193 of file n_time.c.
Referenced by n_time_http_date(), n_time_parse_http_date(), and n_time_rfc2822().