changeset 792:ac49764105cf

[project @ 1994-10-12 16:45:59 by jwe]
author jwe
date Wed, 12 Oct 1994 16:48:35 +0000
parents 29bc04411213
children f7b9920e968b
files configure.in src/timefns.cc src/toplev.h
diffstat 3 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Wed Oct 12 15:40:22 1994 +0000
+++ b/configure.in	Wed Oct 12 16:48:35 1994 +0000
@@ -21,7 +21,7 @@
 dnl along with Octave; see the file COPYING.  If not, write to the Free
 dnl Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 dnl
-AC_REVISION($Revision: 1.56 $)dnl
+AC_REVISION($Revision: 1.57 $)dnl
 AC_PREREQ(1.8)dnl
 AC_INIT(src/octave.cc)
 AC_CONFIG_HEADER(config.h kpathsea/c-auto.h)
@@ -512,6 +512,7 @@
 AC_HAVE_HEADERS(sys/utsname.h sys/time.h sys/fcntl.h)dnl
 AC_HAVE_HEADERS(sys/ttold.h sys/ptem.h sys/select.h)dnl
 AC_DIR_HEADER
+AC_TIME_WITH_SYS_TIME
 dnl
 dnl Use sgtty on Ultrix so that using DEC Migrate to convert a Mips
 dnl binary to an Alpha binary will work.
@@ -543,7 +544,7 @@
 dnl
 AC_HAVE_FUNCS(setvbuf getcwd gethostname bzero rindex vfprintf vsprintf)dnl
 AC_HAVE_FUNCS(stricmp strnicmp strcasecmp strncasecmp strerror)dnl
-AC_HAVE_FUNCS(atexit on_exit tempnam memmove putenv)dnl
+AC_HAVE_FUNCS(atexit on_exit tempnam memmove putenv gettimeofday)dnl
 dnl
 dnl Check to see if we have IEEE math functions, and if so, which ones.
 dnl
--- a/src/timefns.cc	Wed Oct 12 15:40:22 1994 +0000
+++ b/src/timefns.cc	Wed Oct 12 16:48:35 1994 +0000
@@ -25,12 +25,11 @@
 #include "config.h"
 #endif
 
-#include <time.h>
-
 #include "dMatrix.h"
 
 #include "tree-const.h"
 #include "oct-obj.h"
+#include "systime.h"
 #include "defun.h"
 
 DEFUN ("clock", Fclock, Sclock, 1, 0,
@@ -40,8 +39,17 @@
 {
   time_t now;
   struct tm *tm;
+  double fraction = 0.0;
 
+#ifdef HAVE_GETTIMEOFDAY
+  struct timeval tp;
+  gettimeofday (&tp, 0);
+  now = tp.tv_sec;
+  fraction = tp.tv_usec / 1e6;
+#else
   time (&now);
+#endif
+
   tm = localtime (&now);
 
   Matrix m (1, 6);
@@ -50,7 +58,7 @@
   m.elem (0, 2) = tm->tm_mday;
   m.elem (0, 3) = tm->tm_hour;
   m.elem (0, 4) = tm->tm_min;
-  m.elem (0, 5) = tm->tm_sec;
+  m.elem (0, 5) = tm->tm_sec + fraction;
 
   return m;
 }
--- a/src/toplev.h	Wed Oct 12 15:40:22 1994 +0000
+++ b/src/toplev.h	Wed Oct 12 16:48:35 1994 +0000
@@ -71,6 +71,9 @@
 // If nonzero, don't do fancy line editing.
 extern int no_line_editing;
 
+// If nonzero, print verbose info in some cases.
+extern int verbose_flag;
+
 // Command number, counting from the beginning of this session.
 extern int current_command_number;