changeset 6941:3d555cd5ad0f

[project @ 2007-10-01 18:58:29 by jwe]
author jwe
date Mon, 01 Oct 2007 18:58:29 +0000
parents cf41866340d3
children fbf2e8b95a18
files ChangeLog aclocal.m4 configure.in liboctave/ChangeLog liboctave/oct-time.cc src/ChangeLog
diffstat 6 files changed, 18 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Oct 01 18:13:21 2007 +0000
+++ b/ChangeLog	Mon Oct 01 18:58:29 2007 +0000
@@ -1,3 +1,9 @@
+2007-10-01  John W. Eaton  <jwe@octave.org>
+
+	* aclocal.m4 (OCTAVE_CHECK_STRPTIME): Delete.
+	* configure.in: Don't use OCTAVE_CHECK_STRPTIME, simply check for
+	strptime.
+
 2007-09-18  Thomas Treichl  <Thomas.Treichl@gmx.net>
 
 	* aclocal.m4 (OCTAVE_CHECK_STRPTIME): New macro.
--- a/aclocal.m4	Mon Oct 01 18:13:21 2007 +0000
+++ b/aclocal.m4	Mon Oct 01 18:58:29 2007 +0000
@@ -987,67 +987,6 @@
   if test "$octave_cv_hdf5_dll" = yes; then
     AC_DEFINE(_HDF5USEDLL_, 1, [Define if using HDF5 dll (Win32)])
   fi])
-dnl 
-dnl Check to see if the function 'strptime' fills all fields of the tm
-dnl structure correctly or if some systems maybe forget about the tm_wday
-dnl and tm_yday fields (see inline comments below)
-dnl
-AC_DEFUN([OCTAVE_CHECK_STRPTIME],[
-  AC_CHECK_FUNC(strptime)
-  if test "$ac_cv_func_strptime" == yes; then
-    AC_MSG_CHECKING([whether strptime works])
-    AC_CACHE_VAL([octave_cv_strptime],[
-      AC_TRY_RUN([#include <stdio.h>
-      #include <time.h>
-
-      int main (int argc, char *argv[]) {
-
-        struct tm tm;
-        time_t t;
-
-        /* Checks for a handle error if return value == NULL, if so then
-           return an error number immediately */
-        if (strptime("17-09-2007 12:10:20", "%d-%m-%Y %H:%M:%S", &tm) == NULL) {
-          /* printf ("strptime: An handle error occured\n"); */
-          return (1);
-        }
-        /* printf("year: %d; month: %d; day: %d;\n", 
-             tm.tm_year, tm.tm_mon, tm.tm_mday);
-           printf("hour: %d; minute: %d; second: %d\n", 
-             tm.tm_hour, tm.tm_min, tm.tm_sec);
-           printf("strptime: week day: %d, year day: %d\n",
-             tm.tm_wday, tm.tm_yday); */
-
-        /* The hard coded date from above is a 'Monday' and the day
-           number '259' of the year 2007, so tm_wday == 1 and
-           tm_yday == 259, if these values are not set then return 
-           the error number 1 */
-        if (tm.tm_year != 107) return (1);
-        if (tm.tm_mon  != 8)   return (1);
-        if (tm.tm_mday != 17)  return (1);
-        if (tm.tm_hour != 12)  return (1);
-        if (tm.tm_min  != 10)  return (1);
-        if (tm.tm_sec  != 20)  return (1);
-        /* On some system eg. MacOSX and Cygwin the following two fields
-           may be zero, ie. the function does not work as expected */
-        if (tm.tm_wday != 1)   return (1);
-        if (tm.tm_yday != 259) return (1);
-
-        /* If not already returned from this test program then function
-           seems to work correctly */
-        return (0);
-      }],[octave_cv_strptime=yes],[octave_cv_strptime=no],[octave_cv_strptime=no]
-      ) # end of TRY_RUN
-    ])  # end of CACHE_VAL
-
-    AC_MSG_RESULT([$octave_cv_strptime])
-    if test x$octave_cv_strptime = xyes
-    then
-      AC_DEFINE(HAVE_STRPTIME, 1,
-         [Define to 1 if you have a working `strptime' function.])
-    fi
-  fi # if test "$ac_cv_func_strptime" == yes; then
-]) # end of AC_DEFUN of OCTAVE_CHECK_STRPTIME
 dnl
 dnl Check for the QHull version.
 dnl
--- a/configure.in	Mon Oct 01 18:13:21 2007 +0000
+++ b/configure.in	Mon Oct 01 18:58:29 2007 +0000
@@ -29,7 +29,7 @@
 EXTERN_CXXFLAGS="$CXXFLAGS"
 
 AC_INIT
-AC_REVISION($Revision: 1.575 $)
+AC_REVISION($Revision: 1.576 $)
 AC_PREREQ(2.57)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -1437,7 +1437,7 @@
   readlink realpath rename resolvepath rindex rmdir round select setgrent \
   setlocale setpwent setvbuf sigaction siglongjmp sigpending sigprocmask \
   sigsuspend snprintf stat strcasecmp strdup strerror stricmp \
-  strncasecmp strnicmp strsignal symlink tempnam umask \
+  strncasecmp strnicmp strptime strsignal symlink tempnam umask \
   uname unlink usleep utime vfprintf vsprintf vsnprintf waitpid \
   _chmod _snprintf x_utime _utime32)
 
@@ -1452,8 +1452,6 @@
   ;;
 esac
 
-OCTAVE_CHECK_STRPTIME
-
 OCTAVE_SMART_PUTENV
 
 case "$canonical_host_type" in
--- a/liboctave/ChangeLog	Mon Oct 01 18:13:21 2007 +0000
+++ b/liboctave/ChangeLog	Mon Oct 01 18:58:29 2007 +0000
@@ -1,5 +1,9 @@
 2007-10-01  John W. Eaton  <jwe@octave.org>
 
+	* oct-time.cc (octave_strptime::init): Call mktime to propertly
+	initialize wday and yday.
+	From Matthias Drochner <m.drochner@fz-juelich.de>.
+
 	* cmd-edit.cc (command_editor::do_decode_prompt_string): Don't
 	insert extra '\001' when decoding \[ and \].
 
--- a/liboctave/oct-time.cc	Mon Oct 01 18:13:21 2007 +0000
+++ b/liboctave/oct-time.cc	Mon Oct 01 18:58:29 2007 +0000
@@ -27,6 +27,7 @@
 
 #include <climits>
 #include <cmath>
+#include <ctime>
 
 #ifdef HAVE_UNISTD_H
 #ifdef HAVE_SYS_TYPES_H
@@ -355,6 +356,10 @@
 
   char *q = oct_strptime (p, fmt.c_str (), &t);
 
+  // Fill in wday and yday.
+  t.tm_isdst = -1;
+  mktime (&t);
+
   if (q)
     nchars = q - p + 1;
   else
--- a/src/ChangeLog	Mon Oct 01 18:13:21 2007 +0000
+++ b/src/ChangeLog	Mon Oct 01 18:58:29 2007 +0000
@@ -48,6 +48,7 @@
 2007-09-25  Matthias Drochner  <m.drochner@fz-juelich.de>
 
 	* syscalls.cc (Fpopen2): Doc fix.
+	Use "sort -r" instead of "sort -nr" in test.
 
 2007-09-18  John W. Eaton  <jwe@octave.org>