- fix
[oweals/gnunet.git] / src / util / common_logging.c
index 23749dd99f6c9ac16e5622a965a71b2310f5d0a3..cd845cccea3c54711bf2d1df1e6a5144f2ead009 100644 (file)
@@ -842,7 +842,7 @@ GNUNET_log_skip (int n, int check_reset)
     ok = (0 == skip_log);
     skip_log = 0;
     if (check_reset)
-      GNUNET_assert (ok);
+      GNUNET_break (ok);
   }
   else
   {
@@ -886,11 +886,14 @@ mylog (enum GNUNET_ErrorType kind, const char *comp, const char *message,
   memset (date, 0, DATE_STR_SIZE);
   {
     char buf[size];
+    long long offset;
 #ifdef WINDOWS
     LARGE_INTEGER pc;
     time_t timetmp;
 
+    offset = GNUNET_TIME_get_offset ();
     time (&timetmp);
+    timetmp += offset / 1000;
     tmptr = localtime (&timetmp);
     pc.QuadPart = 0;
     QueryPerformanceCounter (&pc);
@@ -909,6 +912,30 @@ mylog (enum GNUNET_ErrorType kind, const char *comp, const char *message,
     struct timeval timeofday;
 
     gettimeofday (&timeofday, NULL);
+    offset = GNUNET_TIME_get_offset ();
+    if (offset > 0)
+    {
+      timeofday.tv_sec += offset / 1000LL;
+      timeofday.tv_usec += (offset % 1000LL) * 1000LL;
+      if (timeofday.tv_usec > 1000000LL)
+      {
+       timeofday.tv_usec -= 1000000LL;
+       timeofday.tv_sec++;
+      }
+    }
+    else
+    {
+      timeofday.tv_sec += offset / 1000LL;
+      if (timeofday.tv_usec > - (offset % 1000LL) * 1000LL)
+      {
+       timeofday.tv_usec += (offset % 1000LL) * 1000LL;
+      }
+      else
+      {
+       timeofday.tv_usec += 1000000LL + (offset % 1000LL) * 1000LL;
+       timeofday.tv_sec--;
+      }
+    }
     tmptr = localtime (&timeofday.tv_sec);
     if (NULL == tmptr)
     {