1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Fix the strftime() function so that the %s format can handle dates outside

of the range of 1901 to 2038.  Ticket #3769. (CVS 6430)

FossilOrigin-Name: a95b843a9251ca9f9a23e8b67c2126f4c297a534
This commit is contained in:
drh
2009-04-01 20:44:13 +00:00
parent 4b2b8b705d
commit 6eb41523f1
4 changed files with 21 additions and 13 deletions

View File

@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: date.c,v 1.103 2009/02/04 03:59:25 shane Exp $
** $Id: date.c,v 1.104 2009/04/01 20:44:14 drh Exp $
**
** SQLite processes all times and dates as Julian Day numbers. The
** dates and times are stored as the number of days since noon
@@ -953,8 +953,8 @@ static void strftimeFunc(
case 'm': sqlite3_snprintf(3, &z[j],"%02d",x.M); j+=2; break;
case 'M': sqlite3_snprintf(3, &z[j],"%02d",x.m); j+=2; break;
case 's': {
sqlite3_snprintf(30,&z[j],"%d",
(int)(x.iJD/1000.0 - 210866760000.0));
sqlite3_snprintf(30,&z[j],"%lld",
(i64)(x.iJD/1000.0 - 210866760000.0));
j += sqlite3Strlen30(&z[j]);
break;
}