* kdb5_edit.c: add struct timeb and sys/timeb includes from
authorMark Eichin <eichin@mit.edu>
Fri, 24 Feb 1995 00:54:58 +0000 (00:54 +0000)
committerMark Eichin <eichin@mit.edu>
Fri, 24 Feb 1995 00:54:58 +0000 (00:54 +0000)
getdate.y.
(ftime): new function, in case we don't HAVE_FTIME.

Ezra's changes, since solaris needs them. kadmin.new/client may need these
too; accordging to glimpse, that's the only other use of ftime...

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4997 dc483132-0cff-0310-8789-dd5450dbe970

src/admin/edit/ChangeLog
src/admin/edit/kdb5_edit.c

index e6142bfb818df33d6f6677b9662fc91478f1904c..ec2ec45e6c39b177cd2688ed61ca1267d2d06afc 100644 (file)
@@ -1,3 +1,9 @@
+Thu Feb 23 19:52:35 1995  Mark Eichin  (eichin@cygnus.com)
+
+       * kdb5_edit.c: add struct timeb and sys/timeb includes from
+       getdate.y.
+       (ftime): new function, in case we don't HAVE_FTIME.
+
 Tue Feb 14 17:55:47 1995  Tom Yu  (tlyu@dragons-lair)
 
        * kdb5_edit.c: add modent
index 77d98726568ead0dd7758c1a1939d688fd38362b..c734eef4c31e66123b8e0e61189447c75f16702e 100644 (file)
 #include <com_err.h>
 #include <stdio.h>
 #include <time.h>
+/* timeb is part of the interface to get_date. */
+#if defined(HAVE_SYS_TIMEB_H)
 #include <sys/timeb.h>
+#else
+/*
+** We use the obsolete `struct timeb' as part of our interface!
+** Since the system doesn't have it, we define it here;
+** our callers must do likewise.
+*/
+struct timeb {
+    time_t             time;           /* Seconds since the epoch      */
+    unsigned short     millitm;        /* Field not used               */
+    short              timezone;       /* Minutes west of GMT          */
+    short              dstflag;        /* Field not used               */
+};
+#endif /* defined(HAVE_SYS_TIMEB_H) */
 
 #include "kdb5_edit.h"
 
@@ -1792,3 +1807,19 @@ quit()
     }
     return 0;
 }
+
+#ifndef HAVE_FTIME
+ftime(tp)
+       register struct timeb *tp;
+{
+       struct timeval t;
+       struct timezone tz;
+
+       if (gettimeofday(&t, &tz) < 0)
+               return (-1);
+       tp->time = t.tv_sec;
+       tp->millitm = t.tv_usec / 1000;
+       tp->timezone = tz.tz_minuteswest;
+       tp->dstflag = tz.tz_dsttime;
+}
+#endif