| | @@ -1166,3 +1166,26 @@ |
| 1166 | 1166 | |
| 1167 | 1167 | Met in rabble, whose daemon (its `PLAN.md`, from 0.2.0) is started by |
| 1168 | 1168 | the client with `fork` and must outlive the terminal (2026-10-21). |
| 1169 | + |
| 1170 | +## The local time zone |
| 1171 | + |
| 1172 | +Library growth that breaks no program: a module, `Zone`, that tells |
| 1173 | +the offset from UTC of the user's time zone at a given time, so that a |
| 1174 | +program can show times as its user's clock does. |
| 1175 | + |
| 1176 | + (* The local zone's offset from UTC, in seconds east, at the time |
| 1177 | + t (seconds since 1970 UTC), and its abbreviation ("CEST"); 0 and |
| 1178 | + "UTC" if no zone can be read. *) |
| 1179 | + proc offset*(t: I64): (INT, []U8); |
| 1180 | + |
| 1181 | +The zone is the one `TZ` names, as a file under `/usr/share/zoneinfo` |
| 1182 | +(`TZ=Europe/Madrid`) or a path (`TZ=/etc/localtime`); with `TZ` unset, |
| 1183 | +`/etc/localtime`. The file is TZif, versions 1 to 4, read once and |
| 1184 | +kept: its transitions, and the POSIX rule in its footer for the times |
| 1185 | +past the last one. A `TZ` written as a POSIX rule itself |
| 1186 | +(`CET-1CEST,M3.5.0,M10.5.0/3`) is read too. No C: the same on every |
| 1187 | +target, with or without libc, so a program's times don't change with |
| 1188 | +the target it is built for. |
| 1189 | + |
| 1190 | +Met in rabble, which shows every time in UTC, in the screen and in its |
| 1191 | +logs, since the library has no zone (2026-10-21). |