Elektrine lite

← Feed

@fleischie28@layer8.space

2026-06-01 19:59 UTC

Hmm, why does zig have no built-in version of: ```c #include <stdio.h> #include <time.h> int main(void) { time_t rawtime; time(&rawtime); struct tm *timeinfo = localtime(&rawtime); fprintf(stdout, "Currently in DST: %s\n", timeinfo->tm_isdst ? "yes" : "no"); } ``` Or am I missing something specific? #c #zig

Replies (1)

  • @fleischie28@layer8.space 2026-06-02 19:23

    Turns out: The standard library has a mechanism to parse tzif files, which has transitions, that can be used to check against the current epoch timestamp. I still use mktime() and localtime(), though, which is kind of annoying but also convenient thanks to the C-interop. 😊

    Open ##4536276