Expand description
datetime submodule.
Date/time utilities — port of Src/Modules/datetime.c.
C source has 0 structs/enums. Rust port matches: 0 types. Functions:
getcurrentsecs[c:206]getcurrentrealtime[c:212]getcurrenttime[c:220]reverse_strftime[c:42]output_strftime[c:99](the actual builtin entry)bin_strftime[c:187](TZ-scope wrapper around output_strftime)- 6 module loaders
C uses libc localtime(3) + zsh’s custom ztrftime() (which
extends POSIX strftime with the %.N nanosecond syntax). The
Rust port calls crate::ported::utils::ztrftime() for the
base format and adds %N extensions on top.
Functions§
- bin_
strftime - Port of
bin_strftime(char *nam, char **argv, Options ops, int func)fromSrc/Modules/datetime.c:187. Thestrftimebuiltin entry — wrapsoutput_strftimein a local param-scope that copies$TZsooutput_strftime’slocaltime(3)calls see the user’s timezone even if a function scope has shadowed it. - boot_
- Port of
boot_(UNUSED(Module m))fromSrc/Modules/datetime.c:292. - cleanup_
- Port of
cleanup_(UNUSED(Module m))fromSrc/Modules/datetime.c:299. C body:return setfeatureenables(m, &module_features, NULL); - enables_
- Port of
enables_(UNUSED(Module m), UNUSED(int **enables))fromSrc/Modules/datetime.c:285. C body:return handlefeatures(m, &module_features, enables); - features_
- Port of
features_(UNUSED(Module m), UNUSED(char ***features))fromSrc/Modules/datetime.c:277. C body:*features = featuresarray(m, &module_features); return 0; - finish_
- Port of
finish_(UNUSED(Module m))fromSrc/Modules/datetime.c:306. - getcurrentrealtime
- Port of
getcurrentrealtime(UNUSED(Param pm))fromSrc/Modules/datetime.c:212. Returns the current high-resolution epoch time as f64 — backs$EPOCHREALTIME. - getcurrentsecs
- Port of
getcurrentsecs(UNUSED(Param pm))fromSrc/Modules/datetime.c:206. Returns the current epoch seconds — backs$EPOCHSECONDS. C body:return (zlong) time(NULL);WARNING: param names don’t match C — Rust=() vs C=(pm) - getcurrenttime
- Port of
getcurrenttime(UNUSED(Param pm))fromSrc/Modules/datetime.c:220. Returns the current epoch as(secs, nanos)— backs the$epochtimetwo-element array param. - output_
strftime - Port of
output_strftime(char *nam, char **argv, Options ops, UNUSED(int func))fromSrc/Modules/datetime.c:99. Theoutput_strftimebuiltin entry. Parses argv (format, timestamp, nanoseconds), callslocaltime(3)to convert, formats viaztrftime()with retry-on-overflow, then writes the result to stdout (orsetsparamto the-s NAMEscalar). - reverse_
strftime - Port of
reverse_strftime(char *nam, char **argv, char *scalar, int quiet)fromSrc/Modules/datetime.c:42. Parses a time string per the format string and assigns the resulting epoch seconds toscalar(or stdout if NULL). - setup_
- Port of
setup_(UNUSED(Module m))fromSrc/Modules/datetime.c:270.