benilla-re systems structs docs

__lc_time_curr

global · crt

Address
0x832398 · 4 bytes, up to 0x83239b
Type
const char **
Meaning
Points to the current time record, the C locale's 0x8323a0; only ___init_time writes it
Confidence
verified, proof one
Finding
crt/time#the-strftime-format-loop

Finding: The strftime format loop in crt: calendar time

strftime(out, max, format, tm) calls _Strftime with no time record, which takes __lc_time_curr, the C locale's record. It copies each byte of the format that is not % while room is left. A % clears the # mark, takes a # after it as the mark, and expands the next byte, whatever it is: a format that ends in % expands its NUL, which writes nothing, and reads on past it. The loop ends when the room or the format runs out; with room left it writes a NUL and answers the bytes before it, else it answers 0 with no NUL written.

The derivation is in the doc.