Fix:Core:MSVC fixes|Thanks chollya
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 24 Jan 2011 16:43:55 +0000 (16:43 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 24 Jan 2011 16:43:55 +0000 (16:43 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@3998 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/log.c

index e2e542a..8874eca 100644 (file)
  * Boston, MA  02110-1301, USA.
  */
 
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 #include <fcntl.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <time.h>
-#include <sys/time.h>
 #include <glib.h>
 #include "file.h"
 #include "item.h"
@@ -49,7 +53,9 @@ struct log {
        int flush_time;
        struct event_timeout *timer;
        struct callback *timer_callback;
+#ifdef HAVE_SYS_TIME_H
        struct timeval last_flush;
+#endif
        char *filename;
        char *filename_ex1;
        char *filename_ex2;
@@ -97,7 +103,9 @@ expand_filenames(struct log *this_)
 static void
 log_set_last_flush(struct log *this_)
 {
+#ifdef HAVE_SYS_TIME_H
        gettimeofday(&this_->last_flush, NULL);
+#endif
 }
 
 static void
@@ -204,6 +212,7 @@ log_change_required(struct log *this_)
 static void
 log_timer(struct log *this_)
 {
+#ifdef HAVE_SYS_TIME_H
        struct timeval tv;
        int delta;
        gettimeofday(&tv, NULL);
@@ -211,6 +220,7 @@ log_timer(struct log *this_)
        dbg(1,"delta=%d flush_time=%d\n", delta, this_->flush_time);
        if (this_->flush_time && delta >= this_->flush_time*1000)
                log_flush(this_,0);
+#endif
 }
 
 int