Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2020 22:01:38 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356706 - head/sbin/savecore
Message-ID:  <202001132201.00DM1cvd045817@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vangyzen
Date: Mon Jan 13 22:01:37 2020
New Revision: 356706
URL: https://svnweb.freebsd.org/changeset/base/356706

Log:
  savecore: include time zone in info.N file
  
  This helps with event correlation when machines are distributed
  across multiple time zones.
  
  Format the time with relaxed ISO 8601 for all the usual reasons.
  
  MFC after:	2 weeks
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sbin/savecore/savecore.c

Modified: head/sbin/savecore/savecore.c
==============================================================================
--- head/sbin/savecore/savecore.c	Mon Jan 13 21:49:27 2020	(r356705)
+++ head/sbin/savecore/savecore.c	Mon Jan 13 22:01:37 2020	(r356706)
@@ -157,6 +157,8 @@ printheader(xo_handle_t *xo, const struct kerneldumphe
 {
 	uint64_t dumplen;
 	time_t t;
+	struct tm tm;
+	char time_str[64];
 	const char *stat_str;
 	const char *comp_str;
 
@@ -189,7 +191,10 @@ printheader(xo_handle_t *xo, const struct kerneldumphe
 	}
 	xo_emit_h(xo, "{P:  }{Lwc:Compression}{:compression/%s}\n", comp_str);
 	t = dtoh64(h->dumptime);
-	xo_emit_h(xo, "{P:  }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t));
+	localtime_r(&t, &tm);
+	if (strftime(time_str, sizeof(time_str), "%F %T %z", &tm) == 0)
+		time_str[0] = '\0';
+	xo_emit_h(xo, "{P:  }{Lwc:Dumptime}{:dumptime/%s}\n", time_str);
 	xo_emit_h(xo, "{P:  }{Lwc:Hostname}{:hostname/%s}\n", h->hostname);
 	xo_emit_h(xo, "{P:  }{Lwc:Magic}{:magic/%s}\n", h->magic);
 	xo_emit_h(xo, "{P:  }{Lwc:Version String}{:version_string/%s}",



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