--- deliantra/server/common/logger.C 2007/01/06 14:42:29 1.8 +++ deliantra/server/common/logger.C 2007/01/07 23:10:42 1.9 @@ -45,22 +45,25 @@ * than any other buffer, since that buffer may * need to be put in this one. */ - char tbuf[20480]; + char msec[20]; + char tbuf[80]; - time_t curtime = time (NULL); - struct tm *ptime = localtime (&curtime); + struct timeval tv; + gettimeofday (&tv, 0); + struct tm *ptime = localtime (&tv.tv_sec); - strftime (tbuf, 256, "%Y-%m-%d %H:%M:%S ", ptime); + strftime (tbuf, sizeof (tbuf), "%Y-%m-%d %H:%M:%S", ptime); + sprintf (msec, ".%03d ", (int)(tv.tv_usec / 1000)); va_list ap; - va_start (ap, format); - vsnprintf (buf, sizeof (buf), format, ap); - strncat (tbuf, buf, 20460); + va_end (ap); + + strncat (tbuf, msec, sizeof (buf)); + strncat (tbuf, buf, sizeof (buf)); + fputs (tbuf, logfile); fputs (tbuf, stderr); - - va_end (ap); } }