From 55eff7ec63b8559372877f6192200b701f00fd5e Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Wed, 10 Jun 2015 11:52:19 +0200 Subject: [PATCH] Implemented "Date/Time format = ..." --- doc/config.html | 8 ++++++++ src/elogd.c | 24 +++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/doc/config.html b/doc/config.html index f8a20465..64de7928 100755 --- a/doc/config.html +++ b/doc/config.html @@ -599,6 +599,10 @@ Admin user = bill %H:%M yields in a display of Thursday, November 15, 2001, 12:35 for example. +
  • + Time format <attribute> = <string>
    + Same, but just for an individual attribute. +
  • Date format = <string>
    This option determines how the date is displayed from attributes which @@ -607,6 +611,10 @@ Admin user = bill %Y yields in a display of Thursday, November 15, 2001 for example.
  • +
  • + Date format <attribute> = <string>
    + Same, but just for an individual attribute. +
  • Welcome Page = <file>
    By default, the list with the last twenty entries of a logbook is diff --git a/src/elogd.c b/src/elogd.c index 985e2267..abdc4eeb 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -8711,7 +8711,10 @@ int build_subst_list(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_ t = (time_t) atoi(attrib[i]); ts = localtime(&t); assert(ts); - if (!getcfg(lbs->name, "Date format", format, sizeof(format))) + + sprintf(str, "Date format %s", attr_list[i]); + if (!getcfg(lbs->name, str, format, sizeof(format))) + if (!getcfg(lbs->name, "Date format", format, sizeof(format))) strcpy(format, DEFAULT_DATE_FORMAT); my_strftime(value[i], NAME_LENGTH, format, ts); @@ -8721,8 +8724,11 @@ int build_subst_list(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_ t = (time_t) atoi(attrib[i]); ts = localtime(&t); assert(ts); - if (!getcfg(lbs->name, "Time format", format, sizeof(format))) - strcpy(format, DEFAULT_TIME_FORMAT); + + sprintf(str, "Time format %s", attr_list[i]); + if (!getcfg(lbs->name, str, format, sizeof(format))) + if (!getcfg(lbs->name, "Time format", format, sizeof(format))) + strcpy(format, DEFAULT_TIME_FORMAT); my_strftime(value[i], NAME_LENGTH, format, ts); @@ -24821,8 +24827,10 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command) rsprintf("\n"); } else if (attr_flags[i] & AF_DATE) { - if (!getcfg(lbs->name, "Date format", format, sizeof(format))) - strcpy(format, DEFAULT_DATE_FORMAT); + sprintf(str, "Date format %s", attr_list[i]); + if (!getcfg(lbs->name, str, format, sizeof(format))) + if (!getcfg(lbs->name, "Date format", format, sizeof(format))) + strcpy(format, DEFAULT_DATE_FORMAT); ltime = atoi(attrib[i]); pts = localtime(<ime); @@ -24836,8 +24844,10 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command) } else if (attr_flags[i] & AF_DATETIME) { - if (!getcfg(lbs->name, "Time format", format, sizeof(format))) - strcpy(format, DEFAULT_TIME_FORMAT); + sprintf(str, "Time format %s", attr_list[i]); + if (!getcfg(lbs->name, str, format, sizeof(format))) + if (!getcfg(lbs->name, "Time format", format, sizeof(format))) + strcpy(format, DEFAULT_TIME_FORMAT); ltime = atoi(attrib[i]); pts = localtime(<ime);