# HG changeset patch # User John W. Eaton # Date 1265090011 18000 # Node ID fa7b5751730cb6f36562d4c0bd558fce5430f128 # Parent e45ccac6017f0d28662e5f4247215258b2f6d261 use gnulib time, sys_time, and sys_times modules diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-02-02 John W. Eaton + + * bootstrap.conf (gnulib_modules): Include sys_time, sys_times, + and time in the list. + * configure.ac: Don't check for sys/time.h, sys/times.h, + sys/stat.h, sys/utimes, or utimes.h. + Don't call AC_HEADER_TIME. + 2010-02-02 John W. Eaton * acinclue.m4 (OCTAVE_STRPTIME_BROKEN): Delete. diff --git a/bootstrap.conf b/bootstrap.conf --- a/bootstrap.conf +++ b/bootstrap.conf @@ -37,6 +37,9 @@ strptime symlink sys_stat + sys_time + sys_times + time times unistd unlink diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1451,7 +1451,6 @@ AC_HEADER_STDC AC_HEADER_DIRENT -AC_HEADER_TIME AC_HEADER_SYS_WAIT ### C headers @@ -1459,9 +1458,8 @@ AC_CHECK_HEADERS(curses.h direct.h dlfcn.h fcntl.h \ floatingpoint.h grp.h ieeefp.h inttypes.h locale.h memory.h nan.h \ ncurses.h poll.h pthread.h pwd.h stdint.h sunmath.h sys/ioctl.h \ - sys/param.h sys/poll.h sys/resource.h sys/select.h sys/stat.h \ - sys/time.h sys/times.h sys/utsname.h sys/utime.h termcap.h \ - utime.h) + sys/param.h sys/poll.h sys/resource.h sys/select.h \ + sys/utsname.h termcap.h) ### C++ headers diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,12 @@ +2010-02-02 John W. Eaton + + * oct-time.h: Include , not "systime.h". + * oct-time.cc: Include , not "strftime.h". + Don't include . + + * systime.h: Delete. + * Makefile.am (INCS): Remove it from the list. + 2010-02-02 John W. Eaton * lo-utils.h, lo-cutils.c (oct_strptime): Delete. diff --git a/liboctave/Makefile.am b/liboctave/Makefile.am --- a/liboctave/Makefile.am +++ b/liboctave/Makefile.am @@ -243,7 +243,6 @@ str-vec.h \ sun-utils.h \ sysdir.h \ - systime.h \ syswait.h \ $(MATRIX_INC) diff --git a/liboctave/oct-time.cc b/liboctave/oct-time.cc --- a/liboctave/oct-time.cc +++ b/liboctave/oct-time.cc @@ -27,18 +27,11 @@ #include #include +#include #include #include -#if defined (OCTAVE_USE_WINDOWS_API) -#define WIN32_LEAN_AND_MEAN -#include -#undef min -#undef max -#endif - -#include -#include "strftime.h" +#include #include "lo-error.h" #include "lo-math.h" diff --git a/liboctave/oct-time.h b/liboctave/oct-time.h --- a/liboctave/oct-time.h +++ b/liboctave/oct-time.h @@ -23,10 +23,10 @@ #if !defined (octave_time_h) #define octave_time_h 1 +#include #include #include "lo-math.h" -#include "systime.h" class octave_base_tm; diff --git a/liboctave/systime.h b/liboctave/systime.h deleted file mode 100644 --- a/liboctave/systime.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - -Copyright (C) 1996, 1997, 1999, 2005, 2007 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -. - -*/ - -#if !defined (octave_systime_h) -#define octave_systime_h 1 - -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else -#ifdef HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif - -#endif diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2010-02-02 John W. Eaton + + * cutils.c: Include , not "systime.h". + * data.cc (Fcputime): Assume we have times. + + * DLD-FUNCTIONS/getrusage.cc (Fgetrusage): Assume we have times. + Include and unconditionally. + Don't include + 2010-02-01 Jaroslav Hajek * strfns.cc (Fstrncmpi): Fix typo in docstring. diff --git a/src/DLD-FUNCTIONS/getrusage.cc b/src/DLD-FUNCTIONS/getrusage.cc --- a/src/DLD-FUNCTIONS/getrusage.cc +++ b/src/DLD-FUNCTIONS/getrusage.cc @@ -25,28 +25,24 @@ #include #endif -#include "systime.h" - +#include +#include #include #ifdef HAVE_SYS_RESOURCE_H #include #endif -#if defined (__WIN32__) -#include -#ifdef min -#undef min -#undef max -#endif -#endif - -#if defined (HAVE_TIMES) && defined (HAVE_SYS_TIMES_H) - #if defined (HAVE_SYS_PARAM_H) #include #endif -#include + +#include "defun-dld.h" +#include "oct-map.h" +#include "sysdep.h" +#include "ov.h" +#include "oct-obj.h" +#include "utils.h" #if !defined (HZ) #if defined (CLK_TCK) @@ -58,15 +54,6 @@ #endif #endif -#endif - -#include "defun-dld.h" -#include "oct-map.h" -#include "sysdep.h" -#include "ov.h" -#include "oct-obj.h" -#include "utils.h" - #ifndef RUSAGE_SELF #define RUSAGE_SELF 0 #endif @@ -172,7 +159,6 @@ #endif #else -#if defined (HAVE_TIMES) && defined (HAVE_SYS_TIMES_H) struct tms t; @@ -198,32 +184,6 @@ tv_tmp.assign ("usec", static_cast (fraction * 1e6 / HZ)); m.assign ("stime", octave_value (tv_tmp)); -#elif defined (__WIN32__) - HANDLE hProcess = GetCurrentProcess (); - FILETIME ftCreation, ftExit, ftUser, ftKernel; - GetProcessTimes (hProcess, &ftCreation, &ftExit, &ftKernel, &ftUser); - - int64_t itmp = *(reinterpret_cast (&ftUser)); - tv_tmp.assign ("sec", static_cast (itmp / 10000000U)); - tv_tmp.assign ("usec", static_cast (itmp % 10000000U) / 10.); - m.assign ("utime", octave_value (tv_tmp)); - - itmp = *(reinterpret_cast (&ftKernel)); - tv_tmp.assign ("sec", static_cast (itmp / 10000000U)); - tv_tmp.assign ("usec", static_cast (itmp % 10000000U) / 10.); - m.assign ("stime", octave_value (tv_tmp)); -#else - - tv_tmp.assign ("sec", 0); - tv_tmp.assign ("usec", 0); - m.assign ("utime", octave_value (tv_tmp)); - - tv_tmp.assign ("sec", 0); - tv_tmp.assign ("usec", 0); - m.assign ("stime", octave_value (tv_tmp)); - -#endif - double tmp = lo_ieee_nan_value (); m.assign ("maxrss", tmp); diff --git a/src/cutils.c b/src/cutils.c --- a/src/cutils.c +++ b/src/cutils.c @@ -35,11 +35,10 @@ #else +#include #include #include -#include "systime.h" - #ifdef HAVE_POLL_H #include #elif HAVE_SYS_POLL_H diff --git a/src/data.cc b/src/data.cc --- a/src/data.cc +++ b/src/data.cc @@ -27,8 +27,6 @@ #include #endif -#include "systime.h" - #include #ifdef HAVE_SYS_RESOURCE_H @@ -41,6 +39,7 @@ #include "lo-ieee.h" #include "lo-math.h" +#include "oct-time.h" #include "str-vec.h" #include "quit.h" #include "mx-base.h" @@ -5667,7 +5666,7 @@ sys = static_cast (ru.ru_stime.tv_sec) + static_cast (ru.ru_stime.tv_usec) * 1e-6; -#elif defined (HAVE_TIMES) && defined (HAVE_SYS_TIMES_H) +#else struct tms t;