From: drh <> Date: Thu, 8 Jan 2026 18:55:49 +0000 (+0000) Subject: Change the name of the log file for tmstmpvfs.c to be an ISO8601 date/time, X-Git-Tag: artiphishell~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c34d56194083a77da7c964a6c494bab58c9a1633;p=thirdparty%2Fsqlite.git Change the name of the log file for tmstmpvfs.c to be an ISO8601 date/time, for improved readability and situational awareness. FossilOrigin-Name: 66018b85a92db2f3b6b15f7c5c0d54bac890f8e50a1839c08857507c39ec4af7 --- diff --git a/ext/misc/tmstmpvfs.c b/ext/misc/tmstmpvfs.c index 37e76f60cb..2ff8b9774c 100644 --- a/ext/misc/tmstmpvfs.c +++ b/ext/misc/tmstmpvfs.c @@ -21,10 +21,10 @@ ** $(DATABASE)-tmstmp/$(TIME)-$(PID)-$(ID) ** ** Log files are only generated if directory $(DATABASE)-tmstmp exists. -** The name of each log file is the current unix-epoch time in millisecond, +** The name of each log file is the current ISO8601 time in milliseconds, ** the process ID, and a random 32-bit value (to disambiguate multiple -** connections from the same process) separated by spaces. The log file -** contains one 16-byte record for various events, such as opening or close +** connections from the same process) separated by dashes. The log file +** contains 16-bytes records for various events, such as opening or close ** of the database or WAL file, writes to the WAL file, checkpoints, and ** similar. The logfile is only generated if the connection attempts to ** modify the database. There is a separate log file for each open database @@ -133,9 +133,9 @@ ** ** $(TIME)-$(PID)-$(RANDOM) ** -** Where TIME is the number of milliseconds since 1970, PID is the process -** ID, and RANDOM is a 32-bit random number. All values are expressed -** in hexadecimal. +** Where TIME is an ISO 8601 date in milliseconds with no punctuation, +** PID is the process ID, and RANDOM is a 32-bit random number expressed +** as hexadecimal. ** ** The log consists of 16-byte records. Each record consists of five ** unsigned integers: @@ -761,11 +761,27 @@ static int tmstmpOpen( p->pPartner = pDb; pDb->pPartner = p; }else{ - sqlite3_uint64 r1; u32 r2; u32 pid; TmstmpLog *pLog; - + sqlite3_uint64 r1; /* Milliseconds since 1970-01-01 */ + sqlite3_uint64 days; /* Days since 1970-01-01 */ + sqlite3_uint64 sod; /* Start of date specified by ms */ + sqlite3_uint64 z; /* Days since 0000-03-01 */ + sqlite3_uint64 era; /* 400-year era */ + int h; /* hour */ + int m; /* minute */ + int s; /* second */ + int f; /* millisecond */ + int Y; /* year */ + int M; /* month */ + int D; /* day */ + int y; /* year assuming March is first month */ + unsigned int doe; /* day of 400-year era */ + unsigned int yoe; /* year of 400-year era */ + unsigned int doy; /* day of year */ + unsigned int mp; /* month with March==0 */ + p->isDb = 1; r1 = 0; pLog = sqlite3_malloc64( sizeof(TmstmpLog) ); @@ -776,10 +792,28 @@ static int tmstmpOpen( p->pLog = pLog; p->pSubVfs->xCurrentTimeInt64(p->pSubVfs, (sqlite3_int64*)&r1); r1 -= 210866760000000LL; + days = r1/86400000; + sod = (r1%86400000)/1000; + f = (int)(r1%1000); + + h = sod/3600; + m = (sod%3600)/60; + s = sod%60; + z = days + 719468; + era = z/147097; + doe = (unsigned)(z - era*146097); + yoe = (doe - doe/1460 + doe/36524 - doe/146096)/365; + y = (int)yoe + era*400; + doy = doe - (365*yoe + yoe/4 - yoe/100); + mp = (5*doy + 2)/153; + D = doy - (153*mp + 2)/5 + 1; + M = mp + (mp<10 ? 3 : -9); + Y = y + (M <=2); sqlite3_randomness(sizeof(r2), &r2); pid = GETPID; - pLog->zLogname = sqlite3_mprintf("%s-tmstmp/%llx-%08x-%08x", - zName, r1, pid, r2); + pLog->zLogname = sqlite3_mprintf( + "%s-tmstmp/%04d%02d%02dT%02d%02d%02d%03d-%08d-%08x", + zName, Y, M, D, h, m, s, f, pid, r2); } tmstmpEvent(p, p->isWal ? ELOG_OPEN_WAL : ELOG_OPEN_DB, 0, GETPID, 0); diff --git a/manifest b/manifest index dc762ab1b1..6c334087b1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\ssqlite3-worker1.mjs\s(ESM,\snon-bundler)\sbuild\sand\shave\sdemo-worker1-promiser\suse\sthat\sfile\srather\sthan\sthe\svanilla\sone,\sas\sa\stest\scase.\sDelete\sthe\sglobal\ssymbol\sinstalled\sby\sthat\sfile\sin\sESM\sand\sbundler\sbuilds,\sas\sit's\sunnecessary\sthere.\sThe\sfirst\schange\sshould\sresolve\s[https://github.com/sqlite/sqlite-wasm/issues/123|downstream\ssqlite-wasm/issues/123],\swith\sthanks\sto\sJure\sRotar\sfor\shis\shelp. -D 2026-01-08T18:15:23.259 +C Change\sthe\sname\sof\sthe\slog\sfile\sfor\stmstmpvfs.c\sto\sbe\san\sISO8601\sdate/time,\nfor\simproved\sreadability\sand\ssituational\sawareness. +D 2026-01-08T18:55:49.653 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -402,7 +402,7 @@ F ext/misc/sqlite3_stdio.h 27a4ecea47e61bc9574ccdf2806f468afe23af2f95028c9b689bf F ext/misc/stmt.c b090086cd6bd6281c21271d38d576eeffe662f0e6b67536352ce32bbaa438321 F ext/misc/stmtrand.c 59cffa5d8e158943ff1ce078956d8e208e8c04e67307e8f249dece2436dcb7fc F ext/misc/templatevtab.c 10f15b165b95423ddef593bc5dcb915ec4eb5e0f1066d585e5435a368b8bc22b -F ext/misc/tmstmpvfs.c 95994e33526581b75bebb320628d220d86c0734807d9780b4f1804e6c7248df2 +F ext/misc/tmstmpvfs.c 6145eb362e3cd48a687c8878766f1eeae396ef29c4c76d3cb9d129ecc3f804e9 F ext/misc/totype.c ba11aac3c0b52c685bd25aa4e0f80c41c624fb1cc5ab763250e09ddc762bc3a8 F ext/misc/uint.c 327afc166058acf566f33a15bf47c869d2d3564612644d9ff81a23efc8b36039 F ext/misc/unionvtab.c 716d385256d5fb4beea31b0efede640807e423e85c9784d21d22f0cce010a785 @@ -2191,8 +2191,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 6fafd010de2d9820f77ee6d2a5f0a7ab1260872d09e95b6932c959ef017aaa77 -R 05da49736bf115619e14c3b0d995d02d -U stephan -Z 63f1243a80186c2d392a85af3d86a66e +P 11f5ab0dd8efc68112c3dc5ea0ed486c32bcdb9fde85352180f40a77c6354cac +R f760f142fa5973d7d03af8a924d0ca1c +U drh +Z 5f2bcf12496f1679771c4516b68a0789 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2adcbd1f9a..30b0969090 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -11f5ab0dd8efc68112c3dc5ea0ed486c32bcdb9fde85352180f40a77c6354cac +66018b85a92db2f3b6b15f7c5c0d54bac890f8e50a1839c08857507c39ec4af7