Skip to main content

Module tm

Module tm 

Source
Expand description

Git-compatible time conversion helpers (ported from Git’s date.c).

Constants§

TIMESTAMP_MAX

Functions§

atoi_bytes
C atoi on a byte slice (optional leading sign for digits).
date_overflows
empty_tm
get_time_sec
Read GIT_TEST_DATE_NOW if set, else current time (seconds).
gm_time_t
Apply Git’s tz HHMM encoding to a UTC instant so gmtime_r yields wall-clock digits.
init_tm_unknown
is_date_known
local_time_tzoffset
Git’s local_time_tzoffset — offset for t in the local zone, as HHMM encoding.
local_tzoffset
Git’s local_tzoffset for a UTC instant.
match_string
maybeiso8601
nodate
parse_timestamp_prefix
Parse leading digits as base-10 (strtoumax / Git’s parse_timestamp).
skip_alpha
time_to_tm
time_to_tm — UTC tm for display with explicit tz offset metadata.
time_to_tm_local
time_to_tm_locallocaltime_r for the current TZ environment.
tm_to_time_t
Git’s tm_to_time_t — like mktime, but without normalization of tm_wday / tm_yday.

Type Aliases§

Timestamp
Unix timestamp as used by Git (timestamp_t is typically uintmax_t).
TzHhmm
Timezone in Git’s signed HHMM encoding (e.g. +200 for +02:00, -500 for -05:00).