tCustomize strftime(3) format in config.h - spoon - dwm status utility (2f30 fo… | |
git clone git://src.adamsgaard.dk/spoon | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 315c36f57ada6030ca250fb103df80d8fffadb51 | |
parent f011c092f921514df9cc293a4ab3ffa4ce5ab4cf | |
Author: lostd <[email protected]> | |
Date: Thu, 13 Oct 2016 16:52:15 +0200 | |
Customize strftime(3) format in config.h | |
Thanks to André Alvaro. | |
Diffstat: | |
M config.def.h | 2 ++ | |
M date.c | 4 +++- | |
2 files changed, 5 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/config.def.h b/config.def.h | |
t@@ -1,5 +1,7 @@ | |
/* delay between each update in seconds */ | |
int delay = 1; | |
+/* format for dateread */ | |
+char timeformat[] = "%a %d %b %Y %H:%M %Z"; | |
struct ent ents[] = { | |
/* reorder this if you want */ | |
diff --git a/date.c b/date.c | |
t@@ -4,6 +4,8 @@ | |
#include <stdio.h> | |
#include <time.h> | |
+extern char timeformat[]; | |
+ | |
int | |
dateread(char *buf, size_t len) | |
{ | |
t@@ -14,6 +16,6 @@ dateread(char *buf, size_t len) | |
now = localtime(&t); | |
if (now == NULL) | |
return -1; | |
- strftime(buf, len, "%a %d %b %Y %H:%M %Z", now); | |
+ strftime(buf, len, timeformat, now); | |
return 0; | |
} |