summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2022-03-18 18:58:51 -0600
committerAaron Ball <nullspoon@oper.io>2022-03-18 18:58:51 -0600
commitc98e6b6adedee9c9576c91ca7c82fcf7d23423bc (patch)
tree3c02cbc2a14f12b5018e10913abf7dcdc34118ac
parent247996f237743b0ff2d2288c41affeab93657bfd (diff)
parent370f9bd0e1719c3a51bb42d1b1272c8ea8c1501f (diff)
downloadi3cstat-c98e6b6adedee9c9576c91ca7c82fcf7d23423bc.tar.gz
i3cstat-c98e6b6adedee9c9576c91ca7c82fcf7d23423bc.tar.xz
Merge branch 'config_time_fmt'
-rw-r--r--src/config_time.c6
-rw-r--r--src/config_time.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/config_time.c b/src/config_time.c
index d6931ff..39c8427 100644
--- a/src/config_time.c
+++ b/src/config_time.c
@@ -22,12 +22,16 @@ void config_time_init(struct node* n) {
n->type = CTYPE_TIME;
n->loadfunc = &config_time_load;
n->loadkey = &load_time_key;
+
+ strcpy(((struct config_time*) n->data)->fmt, "%T");
}
void load_time_key(struct node* n, char* key, char* val) {
if(strcmp(key, "tz") == 0)
strcpy(((struct config_time*) n->data)->tz, val);
+ else if(strcmp(key, "fmt") == 0)
+ strcpy(((struct config_time*) n->data)->fmt, val);
else
printf("ERROR: Unknown time key %s\n", key);
}
@@ -41,7 +45,7 @@ int config_time_load(struct node* n) {
time(&timep);
info = localtime(&timep);
- strftime(n->text, 256, "%T", info);
+ strftime(n->text, 256, ((struct config_time*)n->data)->fmt, info);
strcpy(n->color, C_DGREY);
strcpy(n->label_color, C_LGREY);
diff --git a/src/config_time.h b/src/config_time.h
index 31155be..e8d1ea1 100644
--- a/src/config_time.h
+++ b/src/config_time.h
@@ -29,6 +29,7 @@
struct config_time {
char tz[256];
+ char fmt[128];
};
void config_time_init(struct node*);

Generated by cgit