]> mj.ucw.cz Git - libucw.git/commitdiff
Logging: Let log_msg contain the current time as a timeval, too.
authorMartin Mares <mj@ucw.cz>
Fri, 20 Feb 2009 17:08:46 +0000 (18:08 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 20 Feb 2009 17:08:46 +0000 (18:08 +0100)
ucw/log.c
ucw/log.h

index 5a5dc808c9487ba8d479a896187678701387445f..419c5e9fcca30ef741f625b8ee7bf769894ea25f 100644 (file)
--- a/ucw/log.c
+++ b/ucw/log.c
@@ -118,6 +118,7 @@ vmsg(uns cat, const char *fmt, va_list args)
     {
       /* CAVEAT: These calls are not safe in signal handlers. */
       gettimeofday(&tv, NULL);
+      m.tv = &tv;
       if (localtime_r(&tv.tv_sec, &tm))
        m.tm = &tm;
     }
index d0f1a9f8192f166a346eccc82e43b539de6a4353..14134111ddf446b73fd498b1aed1d7a1fe81408a 100644 (file)
--- a/ucw/log.h
+++ b/ucw/log.h
@@ -22,6 +22,7 @@ struct log_msg {
   char *m;                             // The formatted message itself, ending with \n\0
   int m_len;                           // Length without the \0
   struct tm *tm;                       // Current time
+  struct timeval *tv;
   uns flags;                           // Category and other flags as passed to msg()
   char *raw_msg;                       // Unformatted parts
   char *stime;