1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Fix a round-off error when moving dates by negative modifier amounts.

Ticket #3618.  Enhance the "NNN years" modifier to accept fractional
years. (CVS 6220)

FossilOrigin-Name: 86be908c5e77ba2b9ac98e394fa987b443d790f8
This commit is contained in:
drh
2009-01-30 17:27:44 +00:00
parent 1a38964b50
commit c531a22377
4 changed files with 45 additions and 17 deletions

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing date and time functions.
#
# $Id: date.test,v 1.31 2008/07/08 02:12:37 drh Exp $
# $Id: date.test,v 1.32 2009/01/30 17:27:44 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -454,6 +454,28 @@ datetest 13.6 {strftime('%Y-%m-%d %H:%M:%S', '2007-01-01 23:59:59.6')} \
datetest 13.7 {strftime('%Y-%m-%d %H:%M:%f', '2007-01-01 23:59:59.6')} \
{2007-01-01 23:59:59.600}
# Ticket #3618
datetest 13.11 {julianday(2454832.5,'-1 day')} {2454831.5}
datetest 13.12 {julianday(2454832.5,'+1 day')} {2454833.5}
datetest 13.13 {julianday(2454832.5,'-1.5 day')} {2454831.0}
datetest 13.14 {julianday(2454832.5,'+1.5 day')} {2454834.0}
datetest 13.15 {julianday(2454832.5,'-3 hours')} {2454832.375}
datetest 13.16 {julianday(2454832.5,'+3 hours')} {2454832.625}
datetest 13.17 {julianday(2454832.5,'-45 minutes')} {2454832.46875}
datetest 13.18 {julianday(2454832.5,'+45 minutes')} {2454832.53125}
datetest 13.19 {julianday(2454832.5,'-675 seconds')} {2454832.4921875}
datetest 13.20 {julianday(2454832.5,'+675 seconds')} {2454832.5078125}
datetest 13.21 {julianday(2454832.5,'-1.5 months')} {2454786.5}
datetest 13.22 {julianday(2454832.5,'+1.5 months')} {2454878.5}
datetest 13.23 {julianday(2454832.5,'-1.5 years')} {2454284.0}
datetest 13.24 {julianday(2454832.5,'+1.5 years')} {2455380.0}
datetest 13.30 {date('2000-01-01','+1.5 years')} {2001-07-02}
datetest 13.31 {date('2001-01-01','+1.5 years')} {2002-07-02}
datetest 13.32 {date('2002-01-01','+1.5 years')} {2003-07-02}
datetest 13.33 {date('2002-01-01','-1.5 years')} {2000-07-02}
datetest 13.34 {date('2001-01-01','-1.5 years')} {1999-07-02}
# Test for issues reported by BareFeet (list.sql at tandb.com.au)
# on mailing list on 2008-06-12.
#