The system time zone, and conversions between UTC and local time.
More...
|
| void | pbl_tz_set (const struct pbl_tz *tz) |
| | Set the system time zone.
|
| |
| int32_t | pbl_tz_gmtoff (void) |
| | Get the offset of the time zone from UTC, without DST.
|
| |
| int32_t | pbl_tz_dst_offset (void) |
| | Get the offset added during DST.
|
| |
| time_t | pbl_tz_dst_start (void) |
| | Get the start of the current or next DST period.
|
| |
| bool | pbl_tz_is_dst (time_t utc_time) |
| | Check whether DST applies at a given time.
|
| |
| void | pbl_tz_abbr (char *buf, time_t utc_time) |
| | Get the time zone abbreviation in effect at a given time.
|
| |
| time_t | pbl_tz_utc_to_local (time_t utc_time) |
| | Convert UTC time to local time.
|
| |
| time_t | pbl_tz_local_to_utc (time_t local_time) |
| | Convert local time to UTC time.
|
| |
| struct pbl_tm * | pbl_localtime_r (const time_t *timep, struct pbl_tm *result) |
| | Convert seconds since the epoch to broken-down local time.
|
| |
The system time zone, and conversions between UTC and local time.
The kernel keeps one time zone for the whole system: its offset from UTC, its abbreviations and up to two daylight saving time (DST) periods, the current or next one and the one before it. Whoever knows the time zone sets it with pbl_tz_set(); until then, local time is UTC.
time_t pbl_realtime(void)
Get the wall clock time.
struct pbl_tm * pbl_localtime_r(const time_t *timep, struct pbl_tm *result)
Convert seconds since the epoch to broken-down local time.
structure containing broken-down time for expressing calendar time (ie.
Definition time.h:23
◆ pbl_tz
| Data Fields |
|
char |
dst_abbr[PBL_TZ_LEN] |
Abbreviation during DST, NUL terminated. |
|
time_t |
dst_end |
UTC end of the current or next DST period, 0 if none. |
|
int32_t |
dst_offset |
Offset added to gmtoff during DST, in seconds. |
|
time_t |
dst_start |
UTC start of the current or next DST period, 0 if none. |
|
int32_t |
gmtoff |
Offset from UTC outside DST, in seconds. |
|
time_t |
prev_dst_end |
UTC end of the DST period before dst_start, 0 if none. |
|
time_t |
prev_dst_start |
UTC start of the DST period before dst_start, 0 if none. |
|
char |
std_abbr[PBL_TZ_LEN] |
Abbreviation outside DST, NUL terminated. |
◆ pbl_localtime_r()
| struct pbl_tm * pbl_localtime_r |
( |
const time_t * |
timep, |
|
|
struct pbl_tm * |
result |
|
) |
| |
Convert seconds since the epoch to broken-down local time.
- Parameters
-
| timep | Seconds since the Unix epoch. |
| [out] | result | Broken-down time, in the system time zone. |
- Returns
result.
◆ pbl_tz_abbr()
| void pbl_tz_abbr |
( |
char * |
buf, |
|
|
time_t |
utc_time |
|
) |
| |
Get the time zone abbreviation in effect at a given time.
- Parameters
-
| [out] | buf | Buffer of PBL_TZ_LEN bytes, receives a NUL terminated abbreviation. |
| utc_time | UTC time, deciding whether DST applies. |
◆ pbl_tz_dst_offset()
| int32_t pbl_tz_dst_offset |
( |
void |
| ) |
|
Get the offset added during DST.
- Returns
- Offset in seconds.
◆ pbl_tz_dst_start()
| time_t pbl_tz_dst_start |
( |
void |
| ) |
|
Get the start of the current or next DST period.
- Returns
- UTC time, 0 if none.
◆ pbl_tz_gmtoff()
| int32_t pbl_tz_gmtoff |
( |
void |
| ) |
|
Get the offset of the time zone from UTC, without DST.
- Returns
- Offset in seconds.
◆ pbl_tz_is_dst()
| bool pbl_tz_is_dst |
( |
time_t |
utc_time | ) |
|
Check whether DST applies at a given time.
- Parameters
-
- Returns
- true if
utc_time falls within a DST period.
◆ pbl_tz_local_to_utc()
| time_t pbl_tz_local_to_utc |
( |
time_t |
local_time | ) |
|
Convert local time to UTC time.
Ambiguous during the hour repeated when DST ends.
- Parameters
-
- Returns
- UTC time.
◆ pbl_tz_set()
| void pbl_tz_set |
( |
const struct pbl_tz * |
tz | ) |
|
Set the system time zone.
- Parameters
-
◆ pbl_tz_utc_to_local()
| time_t pbl_tz_utc_to_local |
( |
time_t |
utc_time | ) |
|
Convert UTC time to local time.
- Parameters
-
- Returns
- Local time.