slstatus/components/kanji.c

15 lines
398 B
C
Raw Normal View History

2024-02-27 23:55:39 +00:00
/* Written by Madison Lynch <madi@mxdi.xyz> */
#include <time.h>
const char *
kanji(const char *unused) {
char *kanji[] = {"", "", "", "", "", "", ""};
time_t t=time(NULL);
struct tm tm=*localtime(&t);
int map[]={0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4},
m=tm.tm_mon+1,
y=tm.tm_year+1900-(m<3),
wd=(y+y/4-y/100+y/400+map[m-1]+tm.tm_mday)%7;
return kanji[wd];
}