]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Updated to use localtime_s() in Windows build environments that support it. Ticket...
authorshane <shane@noemail.net>
Tue, 27 May 2008 19:49:21 +0000 (19:49 +0000)
committershane <shane@noemail.net>
Tue, 27 May 2008 19:49:21 +0000 (19:49 +0000)
FossilOrigin-Name: 1518827e48bc3a259b6079a5a4b8dca47b265172

manifest
manifest.uuid
src/date.c

index 8754536a35934180e87721ccadf9c84fb3a3ed9b..e5c1192c09bb63aa8f8a4f23df4f17b5e5babf76 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Explicitly\stypedef\sPgno\sas\s'u32'\sinstead\sof\s'unsigned\sint'\sto\sremove\sa\sfew\swarnings/errors\sfrom\snative\sx86_64\scompile.\s(CVS\s5163)
-D 2008-05-27T18:11:45
+C Updated\sto\suse\slocaltime_s()\sin\sWindows\sbuild\senvironments\sthat\ssupport\sit.\s\sTicket\s#3126.\s(CVS\s5164)
+D 2008-05-27T19:49:21
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in 79aeba12300a54903f1b1257c1e7c190234045dd
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -102,7 +102,7 @@ F src/btreeInt.h dc04ee33d8eb84714b2acdf81336fbbf6e764530
 F src/build.c a52d9d51341444a2131e3431608f245db80d9591
 F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0
 F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131
-F src/date.c e41ce4513fb0e359dc678d6bddb4ace135fe365d
+F src/date.c b305ced9f4da66b51ef020d9bf31c6c92fc0c6bb
 F src/delete.c d3fc5987f2eb88f7b9549d58a5dfea079a83fe8b
 F src/expr.c 89f192b22b8c06b61d9b944cb59f42370d80e362
 F src/fault.c 1f6177188edb00641673e462f3fab8cba9f7422b
@@ -590,7 +590,7 @@ F tool/speedtest16.c 6f5bc019dcf8b6537f379bbac0408a9e1a86f0b6
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c e74126bc12178fa29904f711bb100212a5448041
 F tool/speedtest8inst1.c 025879132979a5fdec11218472cba6cf8f6ec854
-P 54b84a3ddba9d27814c2f613dd197f691ac549a4
-R 355aae5f822bc54cb546f46095fa6fd0
+P b5fd8a239d787a126f775101760737781751f56e
+R 7cfe648a4ba711ba9a867bf6621bf338
 U shane
-Z c8e74ab907b84a5ef7d47d703f1cad85
+Z b944ae1ffa37a17d40e51075e534325a
index 7e4f53d64fcba668629a0d6ebca227bb5015e5d9..04e34a1277945d4813328432cdd0f5a89cee2ade 100644 (file)
@@ -1 +1 @@
-b5fd8a239d787a126f775101760737781751f56e
\ No newline at end of file
+1518827e48bc3a259b6079a5a4b8dca47b265172
\ No newline at end of file
index 8a7206a100c7e4820b915578654ee42acf34571d..c90543ff519bbb4ccd617ece014a62aa5d6a75a1 100644 (file)
@@ -16,7 +16,7 @@
 ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: date.c,v 1.79 2008/03/20 14:03:29 drh Exp $
+** $Id: date.c,v 1.80 2008/05/27 19:49:21 shane Exp $
 **
 ** SQLite processes all times and dates as Julian Day numbers.  The
 ** dates and times are stored as the number of days since noon
 
 #ifndef SQLITE_OMIT_DATETIME_FUNCS
 
+/*
+** On recent Windows platforms, the localtime_s() function is available
+** as part of the "Secure CRT". It is essentially equivalent to 
+** localtime_r() available under most POSIX platforms, except that the 
+** order of the parameters is reversed.
+**
+** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
+**
+** If the user has not indicated to use localtime_r() or localtime_s()
+** already, check for an MSVC build environment that provides 
+** localtime_s().
+*/
+#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
+     defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
+#define HAVE_LOCALTIME_S 1
+#endif
+
 /*
 ** A structure for holding a single date and time.
 */
@@ -434,6 +451,17 @@ static double localtimeOffset(DateTime *p){
     y.m = sLocal.tm_min;
     y.s = sLocal.tm_sec;
   }
+#elif defined(HAVE_LOCALTIME_S)
+  {
+    struct tm sLocal;
+    localtime_s(&sLocal, &t);
+    y.Y = sLocal.tm_year + 1900;
+    y.M = sLocal.tm_mon + 1;
+    y.D = sLocal.tm_mday;
+    y.h = sLocal.tm_hour;
+    y.m = sLocal.tm_min;
+    y.s = sLocal.tm_sec;
+  }
 #else
   {
     struct tm *pTm;