windows: prepare for Windows build split
[fio.git] / os / windows / posix.c
index 488d0ed2c44e16bd1bd82c447b9affb67e567987..ecc8c40885fc622c43537869f85ea9ec007d2a78 100755 (executable)
@@ -18,7 +18,7 @@
 #include <sys/mman.h>
 #include <sys/uio.h>
 #include <sys/resource.h>
-#include <sys/poll.h>
+#include <poll.h>
 #include <sys/wait.h>
 #include <setjmp.h>
 
@@ -228,12 +228,14 @@ void Time_tToSystemTime(time_t dosTime, SYSTEMTIME *systemTime)
 {
     FILETIME utcFT;
     LONGLONG jan1970;
+       SYSTEMTIME tempSystemTime;
 
     jan1970 = Int32x32To64(dosTime, 10000000) + 116444736000000000;
     utcFT.dwLowDateTime = (DWORD)jan1970;
     utcFT.dwHighDateTime = jan1970 >> 32;
 
-    FileTimeToSystemTime((FILETIME*)&utcFT, systemTime);
+    FileTimeToSystemTime((FILETIME*)&utcFT, &tempSystemTime);
+       SystemTimeToTzSpecificLocalTime(NULL, &tempSystemTime, systemTime);
 }
 
 char* ctime_r(const time_t *t, char *buf)
@@ -584,7 +586,8 @@ char *basename(char *path)
        while (path[i] != '\\' && path[i] != '/' && i >= 0)
                i--;
 
-       strncpy(name, path + i + 1, MAX_PATH);
+       name[MAX_PATH - 1] = '\0';
+       strncpy(name, path + i + 1, MAX_PATH - 1);
 
        return name;
 }