SEND-PR: -*- send-pr -*- SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as SEND-PR: will all comments (text enclosed in `<' and `>'). SEND-PR: From: mmatson@apple.com To: mysql@lists.mysql.com Subject: to_days() returns wrong value >Description: to_days() returns wrong integer for some early dates. For dates from '0001-01-01' thru '0199-12-01' give values 730851 thru 767009 respectively. The value given by to_days for these dates correspond to dates greater than '2001-01-01', but not directly to the period '2001-01-01' through '2199-12-31'. >How-To-Repeat: -- wrong values for 0001-01-01 thru 0199-12-31 mysql> select to_days('0199-12-31'); +-----------------------+ | to_days('0199-12-31') | +-----------------------+ | 767009 | +-----------------------+ -- first correct value mysql> select to_days('0200-01-01'); +-----------------------+ | to_days('0200-01-01') | +-----------------------+ | 73049 | +-----------------------+ >Fix: Even though the documentation declairs the to_days() and from_days() functions as not being intended for use prior to year 1582, the functions shouldn't return values valid for dates later than 1582 from dates prior to it. It would be nice to have the functions return the serial number from 1-1-0001 to 12-31-9999 as an increment of the number of days since 1-1-0001 given that it is not the true count of days prior to 1582. If need be, the first serial number could be adjusted by 10 to help account for the changes made to the Gregorian calendar in 1582. >Submitter-Id: >Originator: >Organization: >MySQL support: none >Synopsis: to_days() returns wrong integer for some early dates. >Severity: non-critical >Priority: medium >Category: mysql >Class: sw-bug >Release: mysql-4.0.16-max (Official MySQL-max binary) >C compiler: gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1493) >C++ compiler: gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1493) >Environment: System: Darwin dhcp17106835.corp.apple.com 7.2.0 Darwin Kernel Version 7.2.0: Thu Dec 11 16:20:23 PST 2003; root:xnu/xnu-517.3.7.obj~1/RELEASE_PPC Power Macintosh powerpc Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gcc /usr/bin/cc GCC: Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs Thread model: posix gcc version 3.3 20030304 (Apple Computer, Inc. build 1495) Compilation info: CC='gcc' CFLAGS='-DBIG_TABLES' CXX='gcc' CXXFLAGS='-DBIG_TABLES' LDFLAGS='' ASFLAGS='' LIBC: lrwxr-xr-x 1 root wheel 15 24 Oct 14:36 /usr/lib/libc.dylib -> libSystem.dylib Configure command: ./configure '--prefix=/usr/local/mysql' '--localstatedir=/usr/local/mysql/data' '--libexecdir=/usr/local/mysql/bin' '--with-comment=Official MySQL-max binary' '--with-extra-charsets=complex' '--with-server-suffix=-max' '--enable-thread- safe-client' '--enable-local-infile' '--disable-shared' '--with-embedded-server' '--with-innodb' 'CFLAGS=-DBIG_TABLES' 'CXXFLAGS=-DBIG_TABLES' 'CXX=gcc'