[wiki] [sites] [slstatus][patch][kanji] minor optimization || Madison Lynch
commit 6de1c84677fe6eae65b6fc8b6ce5b43e428b8d23
Author: Madison Lynch <madi_AT_mxdi.xyz>
Date: Sat Feb 18 14:58:23 2023 -0600
[slstatus][patch][kanji] minor optimization
diff --git a/tools.suckless.org/slstatus/patches/kanji/slstatus-kanji.diff b/tools.suckless.org/slstatus/patches/kanji/slstatus-kanji.diff
index 225add6f..538e7adc 100644
--- a/tools.suckless.org/slstatus/patches/kanji/slstatus-kanji.diff
+++ b/tools.suckless.org/slstatus/patches/kanji/slstatus-kanji.diff
_AT_@ -10,7 +10,7 @@
* see keyboard_indicators.c
--- a/components/kanji.c
+++ b/components/kanji.c
-_AT_@ -0,0 +1,14 @@
+_AT_@ -0,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+#include <time.h>
+
_AT_@ -20,8 +20,7 @@
+ int map[]={0,3,2,5,0,3,5,1,4,6,2,4};
+ time_t t=time(NULL);
+ struct tm tm=*localtime(&t);
-+ int m=tm.tm_mon+1,y=tm.tm_year+1900;
-+ y-=m<3;
++ int m=tm.tm_mon+1,y=tm.tm_year+1900-(m<3);
+ int wd=(y+y/4-y/100+y/400+map[m-1]+tm.tm_mday)%7;
+ return kanji[wd-1];
+}
_AT_@ -45,4 +44,4 @@
+const char *kanji(const char *unused);
+
/* kernel_release */
- const char *kernel_release(const char *unused);
+ const char *kernel_release(const char *unused);
\ No newline at end of file
Received on Sat Feb 18 2023 - 22:01:37 CET
This archive was generated by hypermail 2.3.0
: Sat Feb 18 2023 - 22:12:51 CET