From jack@germanium.xtalwind.net  Sun Feb 20 12:02:00 2000
Return-Path: <jack@germanium.xtalwind.net>
Received: from germanium.xtalwind.net (germanium.xtalwind.net [205.160.242.5])
	by hub.freebsd.org (Postfix) with ESMTP id BF1B837BED6
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Feb 2000 12:01:43 -0800 (PST)
	(envelope-from jack@germanium.xtalwind.net)
Received: (from jack@localhost)
	by germanium.xtalwind.net (8.9.3/8.9.3) id PAA01489;
	Sun, 20 Feb 2000 15:01:37 -0500 (EST)
Message-Id: <200002202001.PAA01489@germanium.xtalwind.net>
Date: Sun, 20 Feb 2000 15:01:37 -0500 (EST)
From: jack@germanium.xtalwind.net
Reply-To: jack@germanium.xtalwind.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: MFC: phk's print uptime at reboot
X-Send-Pr-Version: 3.2

>Number:         16838
>Category:       kern
>Synopsis:       MFC/PATCH: phk's print uptime at reboot
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 20 12:10:01 PST 2000
>Closed-Date:    Mon Aug 7 12:26:44 PDT 2000
>Last-Modified:  Mon Aug 07 12:27:41 PDT 2000
>Originator:     
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
>Environment:

	

>Description:

The original commit pretty well covers it.  :)

	I always forget to check before I reboot a system, and while it
	boots I try in vain to remember which month or even year this system
	was last booted in.

	Print out the uptime before rebooting, and give people like me
	less (or more as it may be) to think about while the systems boots.

>How-To-Repeat:

>Fix:

--- kern_shutdown.c.orig	Sun Aug 29 12:26:02 1999
+++ kern_shutdown.c	Sun Feb 20 14:39:53 2000
@@ -125,6 +125,7 @@
 
 static void boot __P((int)) __dead2;
 static void dumpsys __P((void));
+static void print_uptime __P((void));
 
 #ifndef _SYS_SYSPROTO_H_
 struct reboot_args {
@@ -168,6 +169,33 @@
 static int	waittime = -1;
 static struct pcb dumppcb;
 
+static void
+print_uptime()
+{
+    int f;
+	struct timespec ts;
+
+	getnanouptime(&ts);
+	printf("Uptime: ");
+	f = 0;
+	if (ts.tv_sec >= 86400) {
+		printf("%ldd", ts.tv_sec / 86400);
+		ts.tv_sec %= 86400;
+		f = 1;
+	}
+	if (f || ts.tv_sec >= 3600) {
+		printf("%ldh", ts.tv_sec / 3600);
+		ts.tv_sec %= 3600;
+		f = 1;
+	}
+	if (f || ts.tv_sec >= 60) {
+		printf("%ldm", ts.tv_sec / 60);
+		ts.tv_sec %= 60;
+		f = 1;
+	}
+	printf("%lds\n", ts.tv_sec);
+}
+
 /*
  *  Go through the rigmarole of shutting down..
  * this used to be in machdep.c but I'll be dammned if I could see
@@ -271,6 +299,8 @@
 		}
 		DELAY(100000);		/* wait for console output to finish */
 	}
+
+	print_uptime();
 
 	/*
 	 * Ok, now do things that assume all filesystem activity has


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->phk 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Aug 7 07:40:08 PDT 2000 
Responsible-Changed-Why:  
Up to Poul-Henning to merge to RELENG_3 or close. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=16838 
State-Changed-From-To: open->analyzed 
State-Changed-By: phk 
State-Changed-When: Mon Aug 7 11:23:49 PDT 2000 
State-Changed-Why:  
I'm not tracking anything but -current.  Feel free to MFC. 


Responsible-Changed-From-To: phk->bugs 
Responsible-Changed-By: phk 
Responsible-Changed-When: Mon Aug 7 11:23:49 PDT 2000 
Responsible-Changed-Why:  
ditto 

http://www.freebsd.org/cgi/query-pr.cgi?pr=16838 
State-Changed-From-To: analyzed->closed 
State-Changed-By: ps 
State-Changed-When: Mon Aug 7 12:26:44 PDT 2000 
State-Changed-Why:  
Committed, thanks!. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=16838 
>Unformatted:
