diff options
Diffstat (limited to 'src/config_date.c')
-rw-r--r-- | src/config_date.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/config_date.c b/src/config_date.c index 0db56ef..7a4753b 100644 --- a/src/config_date.c +++ b/src/config_date.c @@ -16,32 +16,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "config_date.h" +#include "config_time.h" void config_date_init(struct node* n) { - n->data = malloc(sizeof(struct config_date)); + n->data = malloc(sizeof(struct config_time)); n->type = CTYPE_DATE; - n->loadfunc = &config_date_load; - n->loadkey = &load_date_key; -} + n->loadfunc = &config_time_load; + n->loadkey = &load_time_key; -void load_date_key(struct node* n, char* key, char* val) { - if(strcmp(key, "tz") == 0) - strcpy(((struct config_date*) n->data)->tz, val); - else - printf("ERROR: Unknown time key %s\n", key); + strcpy(((struct config_time*) n->data)->fmt, "%F"); } -int config_date_load(struct node* n) { - char buf[256]; - time_t timep; - struct tm* info; - - setenv("TZ", ((struct config_date*)n->data)->tz, 1); - time(&timep); - info = localtime(&timep); - - strftime(buf, 256, "%F", info); - strcpy(n->label, buf); - strcpy(n->color, C_LGREY); - return 0; -} +// All functions are provided by config_time, since date is just a config_time +// with a different date format. |