28 Feb 1900 reprise



My previous patch omitted to update the reverse function.  I've built
and tested this patch.  It gives 28 as the day of dates 59 and 60
as required.

[The reason behind this patch is that typing in 28Feb1900 into
Gnumeric does not give the same number as doing that in Excel].

Neil.

2002-01-13  Neil Booth  <neil daikokuya demon co uk>

        * datetime.c (date_serial_19000228): Should be 59.
        (datetime_serial_to_g): Update accordingly.

Index: datetime.c
===================================================================
RCS file: /cvs/gnome/gnumeric/src/datetime.c,v
retrieving revision 1.15
diff -u -p -r1.15 datetime.c
--- datetime.c  2002/01/10 06:40:20     1.15
+++ datetime.c  2002/01/13 15:23:28
@@ -27,7 +27,7 @@ static int date_origin = 0;
  * The serial number of 19000228.  Excel allocates a serial number for
  * the non-existing date 19000229.
  */
-static const int date_serial_19000228 = 58;
+static const int date_serial_19000228 = 59;
 
 static void
 date_init (void)
@@ -62,11 +62,9 @@ datetime_serial_to_g (int serial)
 
        if (serial <= date_serial_19000228)
                return g_date_new_julian (serial + date_origin);
-       else if (serial == date_serial_19000228 + 1) {
+       else if (serial == date_serial_19000228 + 1)
                g_warning ("Request for date 19000229.");
-               return g_date_new_julian (serial + date_origin);
-       } else
-               return g_date_new_julian (serial + date_origin - 1);
+       return g_date_new_julian (serial + date_origin - 1);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]