]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a gettimeofday()-based implementation of xCurrentTimeInt64() to os_kv.c.
authordrh <>
Mon, 12 Sep 2022 19:29:34 +0000 (19:29 +0000)
committerdrh <>
Mon, 12 Sep 2022 19:29:34 +0000 (19:29 +0000)
FossilOrigin-Name: e393ed650ef124143f84e9d787fb996e308dd7af6b8f50df72a6f085b67bf9c3

manifest
manifest.uuid
src/os_kv.c

index 06fc95c9d8f9ea185fa69fb0e4d35b4d2a32ba16..15f08523a8fa0143726b0badd4063c1ea3e752e4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sdebugging/testing\sedit\sin\sthe\sprevious\scheck-in.
-D 2022-09-12T18:10:41.031
+C Add\sa\sgettimeofday()-based\simplementation\sof\sxCurrentTimeInt64()\sto\sos_kv.c.
+D 2022-09-12T19:29:34.236
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -574,7 +574,7 @@ F src/notify.c 89a97dc854c3aa62ad5f384ef50c5a4a11d70fcc69f86de3e991573421130ed6
 F src/os.c 0eb831ba3575af5277e47f4edd14fdfc90025c67eb25ce5cda634518d308d4e9
 F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
-F src/os_kv.c 226d9051af316dc547a37629b269ba2aebff8fa21915b91a9b41f7872bb4cc05
+F src/os_kv.c 395b3ab831e0d2b172e6dccf6bae3e21b141f3b6d8b3aa828630634edac2604d
 F src/os_setup.h 0711dbc4678f3ac52d7fe736951b6384a0615387c4ba5135a4764e4e31f4b6a6
 F src/os_unix.c d6322b78130d995160bb9cfb7850678ad6838b08c1d13915461b33326a406c04
 F src/os_win.c e9454cb141908e8eef2102180bad353a36480612d5b736e4c2bd5777d9b25a34
@@ -2004,8 +2004,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 3354a2edb762d70ccc31d4d25f81b70e644d76e01cb1e81d2e97b5414d809d30
-R 742e0e4f6e4e5630d202911ef2cdc14a
+P 6fc8d34c0ae1f8277544be741f2f0835fad8e475d35bd24573224ccc1699b8bd
+R d1f30b2b05b4b258ee2d7add5fd2e488
 U drh
-Z 0a81f46489fd3e0c2c270769139a2009
+Z aaf2d483b1b9208133805d5c75708f65
 # Remove this line to create a well-formed Fossil manifest.
index bf2f87a85b253bc7bce1c60f8f47720862663959..c45584142bcfd6eb3f79d722a048d362d683e14a 100644 (file)
@@ -1 +1 @@
-6fc8d34c0ae1f8277544be741f2f0835fad8e475d35bd24573224ccc1699b8bd
\ No newline at end of file
+e393ed650ef124143f84e9d787fb996e308dd7af6b8f50df72a6f085b67bf9c3
\ No newline at end of file
index ce0a57196506032958fcf57910227f07326e95dc..eebbcd17cd9eea05ed960e11bac99b7dcc2c5c49 100644 (file)
@@ -1081,11 +1081,18 @@ static int kvvfsSleep(sqlite3_vfs *pVfs, int nMicro){
 ** Return the current time as a Julian Day number in *pTimeOut.
 */
 static int kvvfsCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
-  *pTimeOut = 2459829.13362986;
-  return SQLITE_OK;
+  sqlite3_int64 i = 0;
+  int rc;
+  rc = kvvfsCurrentTimeInt64(0, &i);
+  *pTimeOut = i/86400000.0;
+  return rc;
 }
+#include <sys/time.h>
 static int kvvfsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){
-  *pTimeOut = (sqlite3_int64)(2459829.13362986*86400000.0);
+  static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;
+  struct timeval sNow;
+  (void)gettimeofday(&sNow, 0);  /* Cannot fail given valid arguments */
+  *pTimeOut = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000;
   return SQLITE_OK;
 }