use _mkgmtime instead of mktime in parse_iso8601() on windows

Sun, 17 Sep 2023 13:40:48 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 17 Sep 2023 13:40:48 +0200
changeset 793
3ed93d188375
parent 792
4e4e5bbad164
child 794
29d544c3c2b8

use _mkgmtime instead of mktime in parse_iso8601() on windows

libidav/utils.c file | annotate | diff | comparison | revisions
make/vs/test/test.vcxproj file | annotate | diff | comparison | revisions
make/vs/test/test.vcxproj.filters file | annotate | diff | comparison | revisions
--- a/libidav/utils.c	Sun Sep 17 13:18:39 2023 +0200
+++ b/libidav/utils.c	Sun Sep 17 13:40:48 2023 +0200
@@ -138,6 +138,7 @@
     tparts.tm_sec = val % 100;
     tparts.tm_min = (val % 10000) / 100;
     tparts.tm_hour = val / 10000;
+    tparts.tm_isdst = -1;
 
 
     // parse time zone (if any)
@@ -149,7 +150,7 @@
 #if defined(__FreeBSD__)
         return timegm(&tparts);
 #elif defined(_WIN32)
-        return mktime(&tparts);
+        return _mkgmtime(&tparts);
 #else
         return mktime(&tparts) - timezone;
 #endif
@@ -166,7 +167,7 @@
 #if defined(__FreeBSD__)
             return timegm(&tparts) + (time_t) (60 * val * sign);
 #elif defined(_WIN32)
-            return mktime(&tparts) + (time_t)(60 * val * sign);
+            return _mkgmtime(&tparts) + (time_t)(60 * val * sign);
 #else
             return mktime(&tparts) - timezone + (time_t) (60 * val * sign);            
 #endif
--- a/make/vs/test/test.vcxproj	Sun Sep 17 13:18:39 2023 +0200
+++ b/make/vs/test/test.vcxproj	Sun Sep 17 13:40:48 2023 +0200
@@ -106,7 +106,7 @@
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <SDLCheck>true</SDLCheck>
-      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <ConformanceMode>true</ConformanceMode>
       <AdditionalIncludeDirectories>..\..\..\ucx;..\vcpkg_installed\x64-windows\x64-windows\include;..\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <LanguageStandard_C>stdc17</LanguageStandard_C>
@@ -141,11 +141,13 @@
     <ClCompile Include="..\..\..\test\crypto.c" />
     <ClCompile Include="..\..\..\test\main.c" />
     <ClCompile Include="..\..\..\test\test.c" />
+    <ClCompile Include="..\..\..\test\utils.c" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\..\test\base64.h" />
     <ClInclude Include="..\..\..\test\crypto.h" />
     <ClInclude Include="..\..\..\test\test.h" />
+    <ClInclude Include="..\..\..\test\utils.h" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\libidav\libidav.vcxproj">
--- a/make/vs/test/test.vcxproj.filters	Sun Sep 17 13:18:39 2023 +0200
+++ b/make/vs/test/test.vcxproj.filters	Sun Sep 17 13:40:48 2023 +0200
@@ -27,6 +27,9 @@
     <ClCompile Include="..\..\..\test\test.c">
       <Filter>Quelldateien</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\..\test\utils.c">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\..\test\base64.h">
@@ -38,5 +41,8 @@
     <ClInclude Include="..\..\..\test\test.h">
       <Filter>Headerdateien</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\..\test\utils.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>
\ No newline at end of file

mercurial