log_selector +millisec should not change the expansion of %D
(used in log_file_path and maybe other places)
{
struct timeval now;
struct tm * t;
{
struct timeval now;
struct tm * t;
gettimeofday(&now, NULL);
gettimeofday(&now, NULL);
switch(type)
{
case tod_log_bare: /* Format used in logging without timezone */
switch(type)
{
case tod_log_bare: /* Format used in logging without timezone */
- off = sprintf(CS timebuf, "%04d-%02d-%02d %02d:%02d:%02d",
+#ifndef COMPILE_UTILITY
+ if (LOGGING(millisec))
+ sprintf(CS timebuf, "%04d-%02d-%02d %02d:%02d:%02d.%03d",
+ 1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday,
+ t->tm_hour, t->tm_min, t->tm_sec, (int)(now.tv_usec/1000));
+ else
+#endif
+ sprintf(CS timebuf, "%04d-%02d-%02d %02d:%02d:%02d",
1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
break;
/* Format used as suffix of log file name when 'log_datestamp' is active. For
break;
/* Format used as suffix of log file name when 'log_datestamp' is active. For
#ifdef TESTING_LOG_DATESTAMP
case tod_log_datestamp_daily:
case tod_log_datestamp_monthly:
#ifdef TESTING_LOG_DATESTAMP
case tod_log_datestamp_daily:
case tod_log_datestamp_monthly:
- off = sprintf(CS timebuf, "%04d%02d%02d%02d%02d",
+ sprintf(CS timebuf, "%04d%02d%02d%02d%02d",
1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday, t->tm_hour, t->tm_min);
break;
#else
case tod_log_datestamp_daily:
1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday, t->tm_hour, t->tm_min);
break;
#else
case tod_log_datestamp_daily:
- off = sprintf(CS timebuf, "%04d%02d%02d",
+ sprintf(CS timebuf, "%04d%02d%02d",
1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday);
break;
case tod_log_datestamp_monthly:
#ifndef COMPILE_UTILITY
1900 + t->tm_year, 1 + t->tm_mon, t->tm_mday);
break;
case tod_log_datestamp_monthly:
#ifndef COMPILE_UTILITY
- off = sprintf(CS timebuf, "%04d%02d",
+ sprintf(CS timebuf, "%04d%02d",
1900 + t->tm_year, 1 + t->tm_mon);
#endif
break;
1900 + t->tm_year, 1 + t->tm_mon);
#endif
break;
-#ifndef COMPILE_UTILITY
-if (LOGGING(millisec) && off > 0)
- (void) sprintf(CS timebuf + off, ".%03d", (int)(now.tv_usec/1000));
-#else
-off = off; /* Compiler quietening */
-#endif
-