svn commit: r320996 - head/sys/kern

Ian Lepore ian at FreeBSD.org
Fri Jul 14 18:13:55 UTC 2017


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");
 	}


More information about the svn-src-head mailing list