From owner-svn-src-projects@freebsd.org Sat May 21 00:34:55 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E842EB44B2D for ; Sat, 21 May 2016 00:34:55 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B903E1D7A; Sat, 21 May 2016 00:34:55 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4L0YsAs015093; Sat, 21 May 2016 00:34:54 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4L0Ysg7015092; Sat, 21 May 2016 00:34:54 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201605210034.u4L0Ysg7015092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 21 May 2016 00:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r300338 - projects/zfsd/head/lib/libdevdctl X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2016 00:34:56 -0000 Author: asomers Date: Sat May 21 00:34:54 2016 New Revision: 300338 URL: https://svnweb.freebsd.org/changeset/base/300338 Log: Fix zfsd where the timezone is not UTC lib/libdevdctl/event.cc Fix a logic error in Event::TimestampEventString that was timestamping events in the local timezone instead of UTC. Also, simplify the code a bit. Sponsored by: Spectra Logic Corp Modified: projects/zfsd/head/lib/libdevdctl/event.cc Modified: projects/zfsd/head/lib/libdevdctl/event.cc ============================================================================== --- projects/zfsd/head/lib/libdevdctl/event.cc Fri May 20 23:28:43 2016 (r300337) +++ projects/zfsd/head/lib/libdevdctl/event.cc Sat May 21 00:34:54 2016 (r300338) @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -50,6 +49,7 @@ #include #include +#include #include #include #include @@ -430,14 +430,13 @@ Event::TimestampEventString(std::string if (eventString.find("timestamp=") == string::npos) { const size_t bufsize = 32; // Long enough for a 64-bit int timeval now; - struct tm* time_s; char timebuf[bufsize]; size_t eventEnd(eventString.find_last_not_of('\n') + 1); if (gettimeofday(&now, NULL) != 0) err(1, "gettimeofday"); - time_s = gmtime(&now.tv_sec); - strftime(timebuf, bufsize, " timestamp=%s", time_s); + snprintf(timebuf, bufsize, " timestamp=%"PRId64, + (int64_t) now.tv_sec); eventString.insert(eventEnd, timebuf); } }