added patches
This commit is contained in:
parent
f68f49273e
commit
8c6890f943
13 changed files with 395 additions and 205 deletions
30
components/kanji.c
Normal file
30
components/kanji.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* 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(
|
||||
¤t_time
|
||||
)->tm_wday;
|
||||
|
||||
return (weekday < sizeof(symbols) / sizeof(char *)) ? symbols[weekday] : "?";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue