From 1027de07bf1b08d740aada0a229f349b94db4407 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Wed, 7 Mar 2012 15:25:20 -0800
Subject: [PATCH] Add uptime to "slurmd -C" output

---
 doc/man/man8/slurmd.8      |  4 ++--
 src/slurmd/slurmd/slurmd.c | 10 +++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/doc/man/man8/slurmd.8 b/doc/man/man8/slurmd.8
index d0af7ae1326..c0259303be8 100644
--- a/doc/man/man8/slurmd.8
+++ b/doc/man/man8/slurmd.8
@@ -1,4 +1,4 @@
-.TH SLURMD "8" "March 2010" "slurmd 2.2" "Slurm components"
+.TH SLURMD "8" "March 2012" "slurmd 2.4" "Slurm components"
 
 .SH "NAME"
 slurmd \- The compute node daemon for SLURM.
@@ -20,7 +20,7 @@ abnormally.
 .TP
 \fB\-C\fR
 Print actual hardware configuration and exit. The format of output is the same
-as used in \fBslurm.conf\fR to describe a node's configuration.
+as used in \fBslurm.conf\fR to describe a node's configuration plus it's uptime.
 
 .TP
 \fB\-d <file>\fR
diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 91176baaf48..b1e797f6c02 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -1068,6 +1068,7 @@ _destroy_conf(void)
 static void
 _print_config(void)
 {
+	int days, hours, mins, secs;
 	char name[128];
 
 	gethostname_short(name, sizeof(name));
@@ -1086,8 +1087,15 @@ _print_config(void)
 
 	get_memory(&conf->real_memory_size);
 	get_tmp_disk(&conf->tmp_disk_space, "/tmp");
-	printf("RealMemory=%u TmpDisk=%u\n",
+	printf("RealMemory=%u TmpDisk=%u ",
 	       conf->real_memory_size, conf->tmp_disk_space);
+
+	get_up_time(&conf->up_time);
+	secs  =  conf->up_time % 60;
+	mins  = (conf->up_time / 60) % 60;
+	hours = (conf->up_time / 3600) % 24;
+	days  = (conf->up_time / 86400);
+	printf("UpTime=%u-%2.2u:%2.2u:%2.2u\n", days, hours, mins, secs);
 }
 
 static void
-- 
GitLab