benilla-re systems structs docs

__lc_time_c

global · crt

Address
0x8323a0 · 172 bytes, up to 0x83244b
Type
const char *[43]
Meaning
Holds the C locale's day and month names, AM, PM and the date and time patterns strftime reads
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.