mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-12 19:33:03 +00:00
Made substituions work correctly with date attributes
SVN revision: 909
This commit is contained in:
parent
515b08e8b1
commit
73f417b65c
27
src/elogd.c
27
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.348 2004/06/18 19:09:24 midas
|
||||||
|
Made substituions work correctly with date attributes
|
||||||
|
|
||||||
Revision 1.347 2004/06/17 15:16:34 midas
|
Revision 1.347 2004/06/17 15:16:34 midas
|
||||||
Fixed bug with password recovery
|
Fixed bug with password recovery
|
||||||
|
|
||||||
@ -5772,7 +5775,7 @@ int build_subst_list(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char str[NAME_LENGTH], format[256];
|
char str[NAME_LENGTH], format[256];
|
||||||
time_t now;
|
time_t t;
|
||||||
struct tm *ts;
|
struct tm *ts;
|
||||||
|
|
||||||
/* copy attribute list */
|
/* copy attribute list */
|
||||||
@ -5780,9 +5783,19 @@ int build_subst_list(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_
|
|||||||
if (attrib != NULL)
|
if (attrib != NULL)
|
||||||
for (; i < lbs->n_attr; i++) {
|
for (; i < lbs->n_attr; i++) {
|
||||||
strcpy(list[i], attr_list[i]);
|
strcpy(list[i], attr_list[i]);
|
||||||
if (attrib)
|
if (attrib) {
|
||||||
strcpy(value[i], attrib[i]);
|
if ((attr_flags[i] & AF_DATE) && format_date) {
|
||||||
else
|
|
||||||
|
t = (time_t)atoi(attrib[i]);
|
||||||
|
ts = localtime(&t);
|
||||||
|
if (!getcfg(lbs->name, "Time format", format))
|
||||||
|
strcpy(format, DEFAULT_TIME_FORMAT);
|
||||||
|
|
||||||
|
strftime(value[i], NAME_LENGTH, format, ts);
|
||||||
|
|
||||||
|
} else
|
||||||
|
strcpy(value[i], attrib[i]);
|
||||||
|
} else
|
||||||
strcpy(value[i], getparam(attr_list[i]));
|
strcpy(value[i], getparam(attr_list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5811,15 +5824,15 @@ int build_subst_list(LOGBOOK * lbs, char list[][NAME_LENGTH], char value[][NAME_
|
|||||||
|
|
||||||
/* add date */
|
/* add date */
|
||||||
strcpy(list[i], "date");
|
strcpy(list[i], "date");
|
||||||
time(&now);
|
time(&t);
|
||||||
if (format_date) {
|
if (format_date) {
|
||||||
ts = localtime(&now);
|
ts = localtime(&t);
|
||||||
if (!getcfg(lbs->name, "Time format", format))
|
if (!getcfg(lbs->name, "Time format", format))
|
||||||
strcpy(format, DEFAULT_TIME_FORMAT);
|
strcpy(format, DEFAULT_TIME_FORMAT);
|
||||||
|
|
||||||
strftime(str, sizeof(str), format, ts);
|
strftime(str, sizeof(str), format, ts);
|
||||||
} else
|
} else
|
||||||
sprintf(str, "%d", (int) now);
|
sprintf(str, "%d", (int) t);
|
||||||
|
|
||||||
strcpy(value[i++], str);
|
strcpy(value[i++], str);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user