mutate to POSIX-compliant version
authorJohn Kohl <jtkohl@mit.edu>
Thu, 19 Apr 1990 14:03:46 +0000 (14:03 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Thu, 19 Apr 1990 14:03:46 +0000 (14:03 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@509 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/timeofday.c

index b33f30a9ce9b8648ad108b0bb69429da79835beb..1d455ee60fc045899666cbc0de3f4709eded49bd 100644 (file)
@@ -17,26 +17,30 @@ static char rcsid_timeofday_c[] =
 
 #include <krb5/copyright.h>
 
-#include <sys/time.h>                  /* for timeval */
+#include <time.h>
 #include <stdio.h>                     /* needed for libos-proto.h */
 
 #include <krb5/config.h>
 #include <krb5/krb5.h>
 #include <krb5/libos-proto.h>
 
+#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;
-
 }