slstatus/components/kanji.c
2025-03-12 08:38:50 -06:00

30 lines
744 B
C

/* Written by Madison Lynch <madi@mxdi.xyz> */
#include <time.h>
static const char *symbols[] = {
"", // Sunday
"", // Monday
"", // Tuesday
"", // Wednesday
"", // Thursday
"", // Friday
"" // Saturday
};
/**
* Returns the appropriate Japanese Kanji character correlating with the current
* day of the week.
*
* @param unused (NULL)
* @return the appropriate Kanji character (char)
* @author Madison Lynch
*/
const char *
kanji(const char *unused) {
const time_t current_time = time(NULL);
const unsigned int weekday = localtime(
&current_time
)->tm_wday;
return (weekday < sizeof(symbols) / sizeof(char *)) ? symbols[weekday] : "?";
}