Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Dec 2011 20:29:51 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228719 - head/usr.sbin/timed/timed
Message-ID:  <201112192029.pBJKTpDc073856@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon Dec 19 20:29:50 2011
New Revision: 228719
URL: http://svn.freebsd.org/changeset/base/228719

Log:
  Some people pointed out long is 32-bit on some arches, while time_t is
  64-bit, so better cast time_t to intmax_t, and use the appropriate
  printf format strings.
  
  MFC after:	1 week

Modified:
  head/usr.sbin/timed/timed/correct.c
  head/usr.sbin/timed/timed/readmsg.c

Modified: head/usr.sbin/timed/timed/correct.c
==============================================================================
--- head/usr.sbin/timed/timed/correct.c	Mon Dec 19 20:01:21 2011	(r228718)
+++ head/usr.sbin/timed/timed/correct.c	Mon Dec 19 20:29:50 2011	(r228719)
@@ -162,8 +162,8 @@ adjclock(corr)
 		}
 	} else {
 		syslog(LOG_WARNING,
-		       "clock correction %ld sec too large to adjust",
-		       (long)adj.tv_sec);
+		       "clock correction %jd sec too large to adjust",
+		       (intmax_t)adj.tv_sec);
 		(void) gettimeofday(&now, 0);
 		timevaladd(&now, corr);
 		if (settimeofday(&now, 0) < 0)

Modified: head/usr.sbin/timed/timed/readmsg.c
==============================================================================
--- head/usr.sbin/timed/timed/readmsg.c	Mon Dec 19 20:01:21 2011	(r228718)
+++ head/usr.sbin/timed/timed/readmsg.c	Mon Dec 19 20:29:50 2011	(r228719)
@@ -181,8 +181,8 @@ again:
 			rwait.tv_usec = 1000000/CLK_TCK;
 
 		if (trace) {
-			fprintf(fd, "readmsg: wait %ld.%6ld at %s\n",
-				(long)rwait.tv_sec, rwait.tv_usec, date());
+			fprintf(fd, "readmsg: wait %jd.%6ld at %s\n",
+				(intmax_t)rwait.tv_sec, rwait.tv_usec, date());
 			/* Notice a full disk, as we flush trace info.
 			 * It is better to flush periodically than at
 			 * every line because the tracing consists of bursts



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112192029.pBJKTpDc073856>