OSDN Git Service

1998-07-05 Dave Love <d.love@dl.ac.uk>
authorfx <fx@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Jul 1998 08:40:35 +0000 (08:40 +0000)
committerfx <fx@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Jul 1998 08:40:35 +0000 (08:40 +0000)
* f2cext.c (system_clock_): Remove (just f90 intrinsic).
* Makefile.in (F2CEXT): Add datetime, remove sclock.
(UOBJ): Add libU77/datetime_.o.
* libU77/config.h.in: Add HAVE_GETTIMEOFDAY.
* libU77/configure.in: Check for gettimeofday.
* libU77/datetime_.c: New file.
* libU77/sys_clock_.c: Allow optional args.
* libU77/Makefile.in (G77DIR): Fix for current directory
structure.
(SRCS, OBJS): Add datetime.
* libU77/u77-test.f: Call date_and_time.  Call system_clock
omitting args.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20940 138bc75d-0d04-0410-961f-82ee72b054a4

libf2c/libU77/Makefile.in
libf2c/libU77/config.h.in
libf2c/libU77/configure
libf2c/libU77/configure.in
libf2c/libU77/sys_clock_.c
libf2c/libU77/u77-test.f

index c72f2f0..8554293 100644 (file)
@@ -46,7 +46,7 @@ ALL_CFLAGS = -I. -I$(srcdir) -I$(G2C_H_DIR)/libI77 -I$(F2C_H_DIR)/libI77 -I$(G2C
 
 # This could probably be done more elegantly, but it's currently
 # just for running the u77-test test.
-G77DIR = ../../../
+G77DIR = ../../../gcc/
 
 .SUFFIXES:
 .SUFFIXES: .c .o
@@ -63,7 +63,7 @@ OBJS =  VersionU.o gerror_.o perror_.o ierrno_.o itime_.o time_.o \
        bes.o dbes.o \
        chdir_.o chmod_.o lnblnk_.o hostnm_.o rename_.o fgetc_.o fputc_.o \
         umask_.o sys_clock_.o date_.o second_.o flush1_.o mclock_.o \
-       alarm_.o
+       alarm_.o datetime_.o
 SRCS =  Version.c gerror_.c perror_.c ierrno_.c itime_.c time_.c \
        unlink_.c fnum_.c getpid_.c getuid_.c getgid_.c kill_.c rand_.c \
        srand_.c irand_.c sleep_.c idate_.c ctime_.c etime_.c \
@@ -73,7 +73,7 @@ SRCS =  Version.c gerror_.c perror_.c ierrno_.c itime_.c time_.c \
        bes.c dbes.c \
        chdir_.c chmod_.c lnblnk_.c hostnm_.c rename_.c fgetc_.c fputc_.c \
        umask_.c sys_clock_.c date_.c second_.c flush1_.c mclock_.c \
-       alarm_.c
+       alarm_.c datetime_.c
 
 all: $(OBJS)
 
@@ -136,12 +136,13 @@ umask_.o: umask_.c
 flush1_.o: flush1_.c
 mclock_.o: mclock_.c
 alarm_.o: alarm_.c
+datetime_.o: datetime_.c
 
 lint:
        lint $(ALL_CFLAGS) $(SRCS)
 
 check:
-       -$(G77DIR)g77 -B$(G77DIR) -L.. -g $(srcdir)/u77-test.f $(lib) && ./a.out
+       -$(G77DIR)g77 -B$(G77DIR) -ff90-intrinsics-enable -L.. -g $(srcdir)/u77-test.f $(lib) && ./a.out
        rm -f a.out
 
 .PHONY: lint check all
index fcaabce..a20aae6 100644 (file)
@@ -54,6 +54,9 @@
 /* Define if you have the getrusage function.  */
 #undef HAVE_GETRUSAGE
 
+/* Define if you have the gettimeofday function.  */
+#undef HAVE_GETTIMEOFDAY
+
 /* Define if you have the getuid function.  */
 #undef HAVE_GETUID
 
index 8707331..7158236 100755 (executable)
@@ -1343,15 +1343,16 @@ fi
 
 
 for ac_func in symlink getcwd getwd lstat gethostname strerror clock \
-  getrusage times alarm getlogin getgid getuid kill link ttyname
+  getrusage times alarm getlogin getgid getuid kill link ttyname \
+  gettimeofday
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1350: checking for $ac_func" >&5
+echo "configure:1351: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1355 "configure"
+#line 1356 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1374,7 +1375,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
index 6caf4e3..0eb44e7 100644 (file)
@@ -98,7 +98,8 @@ AC_STRUCT_TM
 dnl Checks for library functions.
 
 AC_CHECK_FUNCS(symlink getcwd getwd lstat gethostname strerror clock \
-  getrusage times alarm getlogin getgid getuid kill link ttyname)
+  getrusage times alarm getlogin getgid getuid kill link ttyname \
+  gettimeofday)
 test $ac_cv_func_symlink = yes && MAYBES="$MAYBES symlnk_.o"
 test $ac_cv_func_lstat = yes && MAYBES="$MAYBES lstat_.o"
 test $ac_cv_func_gethostname = yes && MAYBES="$MAYBES hostnm_.o"
index 47436dd..a4b99b8 100644 (file)
@@ -29,14 +29,11 @@ Boston, MA 02111-1307, USA.  */
 #  include <time.h>
 # endif
 #endif
-#if HAVE_SYS_TIMES_H
-#  include <sys/times.h>
-#endif
+#include <sys/times.h>
 #include <limits.h>
 #if HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
-#include <errno.h>             /* for ENOSYS */
 #include "f2c.h"
 
 #ifdef KR_headers
@@ -46,29 +43,25 @@ int G77_system_clock_0 (count, count_rate, count_max)
 int G77_system_clock_0 (integer *count, integer *count_rate, integer *count_max)
 #endif
 {
-#if defined (HAVE_TIMES)
   struct tms buffer;
   unsigned long cnt;
+  if (count_rate) {
 #ifdef _SC_CLK_TCK
-  *count_rate = sysconf(_SC_CLK_TCK);
+    *count_rate = sysconf(_SC_CLK_TCK);
 #elif defined CLOCKS_PER_SECOND
-  *count_rate = CLOCKS_PER_SECOND;
+    *count_rate = CLOCKS_PER_SECOND;
 #elif defined CLK_TCK
-  *count_rate = CLK_TCK;
-#elif defined HZ
-  *count_rate = HZ;
+    *count_rate = CLK_TCK;
 #else
-  #error Dont know clock tick length
+#error Dont know clock tick length
 #endif
-  *count_max = INT_MAX;                /* dubious */
+  }
+  if (count_max)               /* optional arg present? */
+    *count_max = INT_MAX;              /* dubious */
   cnt = times (&buffer);
-  if (cnt > (unsigned long) (*count_max))
-    *count = *count_max;       /* also dubious */
+  if (cnt > (unsigned long) (INT_MAX))
+    *count = INT_MAX;          /* also dubious */
   else
     *count = cnt;
   return 0;
-#else /* ! HAVE_TIMES */
-  errno = ENOSYS;
-  return -1;
-#endif /* ! HAVE_TIMES */
 }
index 9060469..e861617 100644 (file)
      +     fnum, isatty, getarg, access, unlink, fstat,
      +     stat, lstat, getcwd, gmtime, hostnm, etime, chmod,
      +     chdir, fgetc, fputc, system_clock, second, idate, secnds,
-     +     time, ctime, fdate, ttynam
+     +     time, ctime, fdate, ttynam, date_and_time
       external lenstr
       integer lenstr
       logical l
       character gerr*80, c*1
-      character ctim*25, line*80, lognam*20, wd*100, line2*80
+      character ctim*25, line*80, lognam*20, wd*100, line2*80, ddate*8,
+     +     ttime*10, zone*5
       integer fstatb (13), statb (13)
       integer *2 i2zero
+      integer values(8)
 
       ctim = ctime(time())
       WRITE (6,'(A/)') '1 GNU libU77 test at: ' // ctim
       write (6,'(1x,a,9i4)') 'LTIME returns:', ltarray
       call gmtime (j, ltarray)
       write (6,'(1x,a,9i4)') 'GMTIME returns:', ltarray
+      call system_clock(count)  ! omitting optional args
       call system_clock(count, rate, count_max)
       write(6,*) 'SYSTEM_CLOCK returns: ', count, rate, count_max
+      call date_and_time(ddate)  ! omitting optional args
+      call date_and_time(ddate, ttime, zone, values)
+      write(6, *) 'DATE_AND_TIME returns: ', ddate, ' ', ttime, ' ',
+     +     zone, ' ', values
 
       write (6,*) 'Sleeping for 1 second (SLEEP) ...'
       call sleep (1)