aboutsummaryrefslogtreecommitdiff
path: root/libf2c/libU77/datetime_.c
diff options
context:
space:
mode:
authorDave Love <fx@gnu.org>1999-10-12 08:39:35 +0000
committerJeffrey A Law <law@cygnus.com>1999-10-12 08:39:35 +0000
commite150360ad3e9561d74e352124bc8b6ceb4a1d2ed (patch)
treeafea8f99cf901655279f903d5a8387f390d0590d /libf2c/libU77/datetime_.c
parent113e462385805693c2efecd95bd5be6b21b0e68d (diff)
* libU77/aclocal.m4: Re-write, defining LIBU77_GETTIMEOFDAY, not
LIBU77_HAVE_STRUCT_TIMEZONE. * libU77/configure.in: Use LIBU77_GETTIMEOFDAY, not LIBU77_HAVE_STRUCT_TIMEZONE. Don't check for gettimeofday separately. * libU77/datetime_.c (G77_date_and_time_0): Use GETTIMEOFDAY_ONE_ARGUMENT. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@29917 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libf2c/libU77/datetime_.c')
-rw-r--r--libf2c/libU77/datetime_.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/libf2c/libU77/datetime_.c b/libf2c/libU77/datetime_.c
index faf773a944c..1ea77319e96 100644
--- a/libf2c/libU77/datetime_.c
+++ b/libf2c/libU77/datetime_.c
@@ -57,24 +57,30 @@ int G77_date_and_time_0 (char *date, char *fftime, char *zone,
vals[4] = ltime.tm_hour;
vals[5] = ltime.tm_min;
vals[6] = ltime.tm_sec;
- vals[7] = 0; /* no STDC way to get this */
+ vals[7] = 0; /* no STDC/POSIX way to get this */
/* GNUish way; maybe use `ftime' on other systems. */
#if HAVE_GETTIMEOFDAY
{
struct timeval tp;
-#if HAVE_STRUCT_TIMEZONE
+# if GETTIMEOFDAY_ONE_ARGUMENT
+ if (! gettimeofday (&tp))
+# else
+# if HAVE_STRUCT_TIMEZONE
struct timezone tzp;
- /* This is still not strictly correct on some systems such as HPUX,
- which does have struct timezone, but gettimeofday takes void* as
- the 2nd arg. However, the effect of passing anything other than a null
- pointer is unspecified on HPUX. */
+ /* Some systems such as HPUX, do have struct timezone, but
+ gettimeofday takes void* as the 2nd arg. However, the effect
+ of passing anything other than a null pointer is unspecified on
+ HPUX. Configure checks if gettimeofday actually fails with a
+ non-NULL arg and pretends that struct timezone is missing if it
+ does fail. */
if (! gettimeofday (&tp, &tzp))
-#else
+# else
if (! gettimeofday (&tp, (void *) 0))
-#endif
+# endif /* HAVE_STRUCT_TIMEZONE */
+# endif /* GETTIMEOFDAY_ONE_ARGUMENT */
vals[7] = tp.tv_usec/1000;
}
-#endif
+#endif /* HAVE_GETTIMEOFDAY */
if (values) /* null pointer for missing optional */
for (i=0; i<=7; i++)
values[i] = vals[i];