[1094] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

admin/edit/krb5_edit.c and ftime

daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Thu Feb 16 11:10:44 1995

From: epeisach@MIT.EDU
Date: Thu, 16 Feb 1995 11:10:32 -0500
To: krb5-bugs@MIT.EDU


Here is the fix for ftime definition.....

The sys/timeb.h is based on the getdate.y portion at top...
The other part is a definition of ftime that uses the defined structure
(if needed)...


===================================================================
RCS file: /mit/krb5/.cvsroot/src/admin/edit/kdb5_edit.c,v
retrieving revision 5.50
diff -c -r5.50 kdb5_edit.c
*** 5.50	1995/02/14 22:57:45
--- kdb5_edit.c	1995/02/16 16:01:53
***************
*** 36,42 ****
--- 36,56 ----
  #include <com_err.h>
  #include <stdio.h>
  #include <time.h>
+ #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,1794 ****
--- 1806,1824 ----
      }
      return 0;
  }
+ 
+ #if !defined(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

home help back first fref pref prev next nref lref last post