changeset 11005:0de4eff677d6

use mktime module from gnulib
author John W. Eaton <jwe@octave.org>
date Mon, 20 Sep 2010 21:23:10 -0400
parents 594adb99a25e
children aca961a3f387
files ChangeLog bootstrap.conf liboctave/ChangeLog liboctave/oct-time.cc src/ChangeLog src/DLD-FUNCTIONS/time.cc
diffstat 6 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-09-20  John W. Eaton  <jwe@octave.org>
+
+	* bootstrap.conf (gnulib_modules): Include mktime in the list.
+
 2010-09-18  John W. Eaton  <jwe@octave.org>
 
 	* Makefile.am (BUILT_SOURCES): Include run-octave in the list.
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -31,6 +31,7 @@
   lstat
   mkdir
   mkfifo
+  mktime
   nanosleep
   pathmax
   progname
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-20  John W. Eaton  <jwe@octave.org>
+
+	* oct-time.cc (octave_time::octave_time, octave_strptime::init):
+	Call gnulib::mktime instead of mktime (may fix bug #31079).
+
 2010-09-15  Jaroslav Hajek  <highegg@gmail.com>
 
 	* dSparse.h (SparseMatrix::SparseMatrix (const Sparse<double>&)):
--- a/liboctave/oct-time.cc
+++ b/liboctave/oct-time.cc
@@ -58,7 +58,7 @@
   t.tm_zone = ps;
 #endif
 
-  ot_unix_time = mktime (&t);
+  ot_unix_time = gnulib::mktime (&t);
 
 #if defined (HAVE_STRUCT_TM_TM_ZONE)
   delete [] ps;
@@ -272,7 +272,7 @@
   if (t.tm_mday != 0 && t.tm_mon >= 0 && t.tm_year != INT_MIN)
     {
       t.tm_isdst = -1;
-      mktime (&t);
+      gnulib::mktime (&t);
     }
 
   if (t.tm_mon < 0)
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2010-09-20  John W. Eaton  <jwe@octave.org>
+
+	* DLD-FUNCTIONS/time.cc (Fmktime): New tests (bug #31079).
+
 2010-09-20  John W. Eaton  <jwe@octave.org>
 
 	Bug #31085:
--- a/src/DLD-FUNCTIONS/time.cc
+++ b/src/DLD-FUNCTIONS/time.cc
@@ -279,6 +279,12 @@
 
 %!error <Invalid call to mktime.*> mktime (1, 2, 3);
 
+%% These tests fail on systems with mktime functions of limited
+%% intelligence:
+%!assert (datestr (datenum (1969, 1, 1), 0), "01-Jan-1969 00:00:00")
+%!assert (datestr (datenum (1901, 1, 1), 0), "01-Jan-1901 00:00:00")
+%!assert (datestr (datenum (1795, 1, 1), 0), "01-Jan-1795 00:00:00")
+
 */
 
 DEFUN_DLD (strftime, args, ,