/ Check-in [14226ff0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added more DST boundary checks for 2006 and 2007. Added check for suspect Windows DST implementations and warning about them. Ticket #2322. (CVS 5147)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 14226ff0a7af7b39a1089a17eeb5bbb8d09d778d
User & Date: shane 2008-05-20 14:01:59
Context
2008-05-20
15:44
Changes to the error handling policies of sqlite3_exec() to make them more consistent. Changes to the documentation on the error handling polices of sqlite3_exec() so that the documentation and code agree. (CVS 5148) check-in: a0376c79 user: drh tags: trunk
14:01
Added more DST boundary checks for 2006 and 2007. Added check for suspect Windows DST implementations and warning about them. Ticket #2322. (CVS 5147) check-in: 14226ff0 user: shane tags: trunk
13:17
Updated test case for Windows to get around problems in ticket #3129. (CVS 5146) check-in: 2faf69ca user: shane tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/date.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing date and time functions.
    13     13   #
    14         -# $Id: date.test,v 1.26 2008/04/15 04:02:41 drh Exp $
           14  +# $Id: date.test,v 1.27 2008/05/20 14:01:59 shane Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Skip this whole file if date and time functions are omitted
    20     20   # at compile-time
    21     21   #
................................................................................
   218    218   datetest 5.14 {datetime('1994-04-16 14:00:00Z +05:00')} NULL
   219    219   datetest 5.15 {datetime('1994-04-16 14:00:00 +05:00 Z')} NULL
   220    220   
   221    221   # localtime->utc and utc->localtime conversions.  These tests only work
   222    222   # if the localtime is in the US Eastern Time (the time in Charlotte, NC
   223    223   # and in New York.)
   224    224   #
   225         -set tzoffset [db one {
   226         -  SELECT CAST(24*(julianday('2006-09-01') -
   227         -                  julianday('2006-09-01','localtime'))+0.5
          225  +# On non-Vista Windows platform, '2006-03-31' is treated incorrectly as being
          226  +# in DST giving a 4 hour offset instead of 5.  In 2007, DST was extended to 
          227  +# start three weeks earlier (second Sunday in March) and end one week
          228  +# later (first Sunday in November).  Older Windows systems apply this
          229  +# new rule incorrectly to dates prior to 2007.
          230  +#
          231  +# It might be argued that this is masking a problem on non-Vista Windows
          232  +# platform.  A ticket has already been opened for this issue 
          233  +# (http://www.sqlite.org/cvstrac/tktview?tn=2322).  This is just to prevent
          234  +# more confusion/reports of the issue.
          235  +#
          236  +
          237  +# $tzoffset_old should be 5 if DST is working correctly.
          238  +set tzoffset_old [db one {
          239  +  SELECT CAST(24*(julianday('2006-03-31') -
          240  +                  julianday('2006-03-31','localtime'))+0.5
          241  +              AS INT)
          242  +}]
          243  +
          244  +# $tzoffset_new should be 4 if DST is working correctly.
          245  +set tzoffset_new [db one {
          246  +  SELECT CAST(24*(julianday('2007-03-31') -
          247  +                  julianday('2007-03-31','localtime'))+0.5
   228    248                 AS INT)
   229    249   }]
   230         -if {$tzoffset==4} {
          250  +
          251  +# Warn about possibly broken Windows DST implementations.
          252  +if {$::tcl_platform(platform)=="windows" && $tzoffset_new==4 && $tzoffset_old==4} {
          253  +  puts "******************************************************************"
          254  +  puts "N.B.:  The DST support provided by your current O/S seems to be"
          255  +  puts "suspect in that it is reporting incorrect DST values for dates"
          256  +  puts "prior to 2007.  This is the known case for most (all?) non-Vista"
          257  +  puts "Windows versions.  Please see ticket #2322 for more information."
          258  +  puts "******************************************************************"
          259  +}
          260  +
          261  +if {$tzoffset_new==4} {
   231    262     datetest 6.1 {datetime('2000-10-29 05:59:00','localtime')}\
   232    263         {2000-10-29 01:59:00}
   233         -  datetest 6.2 {datetime('2000-10-29 06:00:00','localtime')}\
   234         -      {2000-10-29 01:00:00}
   235         -  datetest 6.3 {datetime('2000-04-02 06:59:00','localtime')}\
   236         -      {2000-04-02 01:59:00}
          264  +  datetest 6.1.1 {datetime('2006-10-29 05:59:00','localtime')}\
          265  +      {2006-10-29 01:59:00}
          266  +  datetest 6.1.2 {datetime('2007-11-04 05:59:00','localtime')}\
          267  +      {2007-11-04 01:59:00}
          268  +
          269  +  # If the new and old DST rules seem to be working correctly...
          270  +  if {$tzoffset_new==4 && $tzoffset_old==5} {
          271  +    datetest 6.2 {datetime('2000-10-29 06:00:00','localtime')}\
          272  +        {2000-10-29 01:00:00}
          273  +    datetest 6.2.1 {datetime('2006-10-29 06:00:00','localtime')}\
          274  +        {2006-10-29 01:00:00}
          275  +  }
          276  +  datetest 6.2.2 {datetime('2007-11-04 06:00:00','localtime')}\
          277  +      {2007-11-04 01:00:00}
          278  +
          279  +  # If the new and old DST rules seem to be working correctly...
          280  +  if {$tzoffset_new==4 && $tzoffset_old==5} {
          281  +    datetest 6.3 {datetime('2000-04-02 06:59:00','localtime')}\
          282  +        {2000-04-02 01:59:00}
          283  +    datetest 6.3.1 {datetime('2006-04-02 06:59:00','localtime')}\
          284  +        {2006-04-02 01:59:00}
          285  +  }
          286  +  datetest 6.3.2 {datetime('2007-03-11 07:00:00','localtime')}\
          287  +      {2007-03-11 03:00:00}
          288  +
   237    289     datetest 6.4 {datetime('2000-04-02 07:00:00','localtime')}\
   238    290         {2000-04-02 03:00:00}
          291  +  datetest 6.4.1 {datetime('2006-04-02 07:00:00','localtime')}\
          292  +      {2006-04-02 03:00:00}
          293  +  datetest 6.4.2 {datetime('2007-03-11 07:00:00','localtime')}\
          294  +      {2007-03-11 03:00:00}
          295  +      
   239    296     datetest 6.5 {datetime('2000-10-29 01:59:00','utc')} {2000-10-29 05:59:00}
   240         -  datetest 6.6 {datetime('2000-10-29 02:00:00','utc')} {2000-10-29 07:00:00}
   241         -  datetest 6.7 {datetime('2000-04-02 01:59:00','utc')} {2000-04-02 06:59:00}
          297  +  datetest 6.5.1 {datetime('2006-10-29 01:59:00','utc')} {2006-10-29 05:59:00}
          298  +  datetest 6.5.2 {datetime('2007-11-04 01:59:00','utc')} {2007-11-04 05:59:00}
          299  +
          300  +  # If the new and old DST rules seem to be working correctly...
          301  +  if {$tzoffset_new==4 && $tzoffset_old==5} {
          302  +    datetest 6.6 {datetime('2000-10-29 02:00:00','utc')} {2000-10-29 07:00:00}
          303  +    datetest 6.6.1 {datetime('2006-10-29 02:00:00','utc')} {2006-10-29 07:00:00}
          304  +  }
          305  +  datetest 6.6.2 {datetime('2007-11-04 02:00:00','utc')} {2007-11-04 07:00:00}
          306  +
          307  +  # If the new and old DST rules seem to be working correctly...
          308  +  if {$tzoffset_new==4 && $tzoffset_old==5} {
          309  +    datetest 6.7 {datetime('2000-04-02 01:59:00','utc')} {2000-04-02 06:59:00}
          310  +    datetest 6.7.1 {datetime('2006-04-02 01:59:00','utc')} {2006-04-02 06:59:00}
          311  +  }
          312  +  datetest 6.7.2 {datetime('2007-03-11 01:59:00','utc')} {2007-03-11 06:59:00}
          313  +
   242    314     datetest 6.8 {datetime('2000-04-02 02:00:00','utc')} {2000-04-02 06:00:00}
          315  +  datetest 6.8.1 {datetime('2006-04-02 02:00:00','utc')} {2006-04-02 06:00:00}
          316  +  datetest 6.8.2 {datetime('2007-03-11 02:00:00','utc')} {2007-03-11 06:00:00}
   243    317   
   244    318     datetest 6.10 {datetime('2000-01-01 12:00:00','localtime')} \
   245    319         {2000-01-01 07:00:00}
   246    320     datetest 6.11 {datetime('1969-01-01 12:00:00','localtime')} \
   247    321         {1969-01-01 07:00:00}
   248    322     datetest 6.12 {datetime('2039-01-01 12:00:00','localtime')} \
   249    323         {2039-01-01 07:00:00}
................................................................................
   372    446     {2007-01-01 12:59:59}
   373    447   datetest 13.5 {strftime('%Y-%m-%d %H:%M:%f', '2007-01-01 12:59:59.6')} \
   374    448     {2007-01-01 12:59:59.600}
   375    449   datetest 13.6 {strftime('%Y-%m-%d %H:%M:%S', '2007-01-01 23:59:59.6')} \
   376    450     {2007-01-01 23:59:59}
   377    451   datetest 13.7 {strftime('%Y-%m-%d %H:%M:%f', '2007-01-01 23:59:59.6')} \
   378    452     {2007-01-01 23:59:59.600}
   379         -
   380    453   
   381    454   finish_test