Subject: Re: new ntpd fails to compile on alpha...
To: None <current-users@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: current-users
Date: 07/29/2006 17:29:55
In article <44CB7D6A.50005@netbsd.org>,
Frank Kardel  <kardel@netbsd.org> wrote:

>Index: refclock_oncore.c
>===================================================================
>RCS file: /cvsroot/src/dist/ntp/ntpd/refclock_oncore.c,v
>retrieving revision 1.8
>diff -u -r1.8 refclock_oncore.c
>--- refclock_oncore.c	11 Jun 2006 19:34:12 -0000	1.8
>+++ refclock_oncore.c	29 Jul 2006 15:19:55 -0000
>@@ -3317,8 +3317,17 @@
> 
> 	/* and set time to time from Computer clock */
> 
>-	gettimeofday(&tv, 0);
>-	tm = gmtime((const time_t *) &tv.tv_sec);
>+	{
>+		/*
>+		 * XXX NetBSD (20060729) defines tv_sec as a long
>+		 *  -> non standard and doesn't even work within the system
>+		 *     without kludges like the one below
>+		 */ 
>+		time_t help;
>+		gettimeofday(&tv, 0);
>+		help = tv.tv_sec;
>+		tm = gmtime((const time_t *) &help);
>+	}
> #if 1
> 	{
> 	char Msg[160];

- remove the cast in gmtime()
- the comment is incorrect. time_t and tv_sec are not guaranteed to
  map to the same integral type. In fact, time_t is allowed by the standard
  to be any size, even a float as long as it is signed.

christos