From ee2a387103b2f26998308257a41c59246ed28807 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Thu, 19 Apr 1990 14:03:46 +0000 Subject: [PATCH] mutate to POSIX-compliant version git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@509 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/os/timeofday.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/krb5/os/timeofday.c b/src/lib/krb5/os/timeofday.c index b33f30a9c..1d455ee60 100644 --- a/src/lib/krb5/os/timeofday.c +++ b/src/lib/krb5/os/timeofday.c @@ -17,26 +17,30 @@ static char rcsid_timeofday_c[] = #include -#include /* for timeval */ +#include #include /* needed for libos-proto.h */ #include #include #include +#ifdef POSIX +#define timetype time_t +#else +#define timetype long +#endif + extern int errno; krb5_error_code krb5_timeofday(timeret) register krb5_int32 *timeret; { - struct timeval tv; + timetype tval; - if (gettimeofday(&tv, (struct timezone *)0) == -1) { - /* failed, return errno */ + tval = time(0); + if (tval == (timetype) -1) return (krb5_error_code) errno; - } - *timeret = tv.tv_sec; + *timeret = tval; return 0; - } -- 2.26.2