Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jul 2017 18:13:54 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320996 - head/sys/kern
Message-ID:  <201707141813.v6EIDsda006887@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Fri Jul 14 18:13:54 2017
New Revision: 320996
URL: https://svnweb.freebsd.org/changeset/base/320996

Log:
  Allow setting debug.clocktime as a tunable.  Print 64-bit time_t correctly
  on 32-bit systems.

Modified:
  head/sys/kern/subr_clock.c

Modified: head/sys/kern/subr_clock.c
==============================================================================
--- head/sys/kern/subr_clock.c	Fri Jul 14 17:41:15 2017	(r320995)
+++ head/sys/kern/subr_clock.c	Fri Jul 14 18:13:54 2017	(r320996)
@@ -72,7 +72,7 @@ SYSCTL_PROC(_machdep, OID_AUTO, adjkerntz, CTLTYPE_INT
     "Local offset from UTC in seconds");
 
 static int ct_debug;
-SYSCTL_INT(_debug, OID_AUTO, clocktime, CTLFLAG_RW,
+SYSCTL_INT(_debug, OID_AUTO, clocktime, CTLFLAG_RWTUN,
     &ct_debug, 0, "Enable printing of clocktime debugging");
 
 static int wall_cmos_clock;
@@ -171,7 +171,7 @@ clock_ct_to_ts(struct clocktime *ct, struct timespec *
 	ts->tv_nsec = ct->nsec;
 
 	if (ct_debug)
-		printf(" = %ld.%09ld\n", (long)ts->tv_sec, (long)ts->tv_nsec);
+		printf(" = %jd.%09ld\n", (intmax_t)ts->tv_sec, ts->tv_nsec);
 	return (0);
 }
 
@@ -209,8 +209,8 @@ clock_ts_to_ct(struct timespec *ts, struct clocktime *
 	ct->sec  = rsec;
 	ct->nsec = ts->tv_nsec;
 	if (ct_debug) {
-		printf("ts_to_ct(%ld.%09ld) = ",
-		    (long)ts->tv_sec, (long)ts->tv_nsec);
+		printf("ts_to_ct(%jd.%09ld) = ",
+		    (intmax_t)ts->tv_sec, ts->tv_nsec);
 		print_ct(ct);
 		printf("\n");
 	}



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