Rethinking the C Time API
Out of all the components of C, its time API is probably the one most plagued with legacy cruft.
To the point almost every regularly used element of it has some design decision that’s been obsolete for
decades.
As a example, here is some code I use to print the current time for my status bar:
#include <stdio.h>
#include <time.h>
#include <unistd.h>
int main(void)
{
char buf[40];
time_t now = time(0);
while (1) {
strftime(buf, 40, "%a %b %d %T", localtime(&now));
puts(buf);
fflush(stdout);
sleep(...
Read more at oliverkwebb.github.io