6464408 Timestamp on /var/adm/messages is wrong after 248 days
authorkk112340
Tue, 19 Sep 2006 23:21:03 -0700
changeset 2771 3414606edb08
parent 2770 f092ed230248
child 2772 284bda1a2ceb
6464408 Timestamp on /var/adm/messages is wrong after 248 days
usr/src/uts/common/os/logsubr.c
--- a/usr/src/uts/common/os/logsubr.c	Tue Sep 19 21:05:03 2006 -0700
+++ b/usr/src/uts/common/os/logsubr.c	Tue Sep 19 23:21:03 2006 -0700
@@ -327,12 +327,11 @@
 		lc->flags |= SL_LOGONLY;
 
 		/*
-		 * In the early boot phase hrestime is invalid.
-		 * hrestime becomes valid when clock() runs for the first time.
-		 * At this time is lbolt == 1. log_sendmsg() saves the lbolt
-		 * value in ltime.
+		 * The ttime is written with 0 in log_sensmsg() only when
+		 * good gethrestime_sec() data is not available to store in
+		 * the log_ctl_t in the early boot phase.
 		 */
-		if (lc->ltime < 2) {
+		if (lc->ttime == 0) {
 			/*
 			 * Look ahead to first early boot message with time.
 			 */
@@ -605,8 +604,21 @@
 
 	log_enter();
 
+	/*
+	 * In the early boot phase hrestime is invalid, then timechanged is 0.
+	 * If hrestime is not valid, the ttime is set to 0 here and the correct
+	 * ttime is calculated in log_conswitch() later. The log_conswitch()
+	 * calculation to determine the correct ttime does not use ttime data
+	 * from these log_ctl_t structures; it only uses ttime from log_ctl_t's
+	 * that contain good data.
+	 *
+	 */
 	lc->ltime = lbolt;
-	lc->ttime = gethrestime_sec();
+	if (timechanged) {
+		lc->ttime = gethrestime_sec();
+	} else {
+		lc->ttime = 0;
+	}
 
 	flags = lc->flags & lzp->lz_active;
 	log_seq_no[flags & SL_ERROR]++;