diff options
-rw-r--r-- | src/config_time.c | 6 | ||||
-rw-r--r-- | src/config_time.h | 1 |
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*); |