This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
win32_utime() on directories should use localtime() rather
authorGurusamy Sarathy <gsar@cpan.org>
Fri, 22 Oct 1999 16:36:46 +0000 (16:36 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Fri, 22 Oct 1999 16:36:46 +0000 (16:36 +0000)
than gmtime() (from Jan Dubois)

p4raw-id: //depot/perl@4420

win32/win32.c

index 4f0d7f8..1bfb6fe 100644 (file)
@@ -1296,14 +1296,13 @@ win32_times(struct tms *timebuf)
     return 0;
 }
 
-/* fix utime() so it works on directories in NT
- * thanks to Jan Dubois <jan.dubois@ibm.net>
- */
+/* fix utime() so it works on directories in NT */
 static BOOL
 filetime_from_time(PFILETIME pFileTime, time_t Time)
 {
-    struct tm *pTM = gmtime(&Time);
+    struct tm *pTM = localtime(&Time);
     SYSTEMTIME SystemTime;
+    FILETIME LocalTime;
 
     if (pTM == NULL)
        return FALSE;
@@ -1316,7 +1315,8 @@ filetime_from_time(PFILETIME pFileTime, time_t Time)
     SystemTime.wSecond = pTM->tm_sec;
     SystemTime.wMilliseconds = 0;
 
-    return SystemTimeToFileTime(&SystemTime, pFileTime);
+    return SystemTimeToFileTime(&SystemTime, &LocalTime) &&
+           LocalFileTimeToFileTime(&LocalTime, pFileTime);
 }
 
 DllExport int