From nobody Thu Mar 10 06:20:00 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9E27A1A096D4; Thu, 10 Mar 2022 06:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KDf743CWgz3pXV; Thu, 10 Mar 2022 06:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646893200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5z/rvgpvKhrwp9p1tQZQdg1U1NEA4D5GPtLOc2m2SWU=; b=J/fvSFbO2+6Ok40cscyOsficAESkm3OJAoe37E/WASOk7eNqg5VpF74nL6EHtEaFO7aQps xXYfjSqb8jnnql90+QZ3EVgBh4XX5O4ZJ1Ru2kFqPI2h1mfnasWkYtt+CPRW9JHUZm4JH0 Nu7/Lzn+yGiWhEWP/UfzeffxohVgkk+vBZ5e0WJ41k67cN+BL8jS0bT1RxnfX4I/SRXA1b zBY12bnDe2IZVPtA/fULQfDoPei1CjYpvbIax2wo9RMEKbrAt0auua+7zDvt0ChCgbUsTd ymucvcik1l2ayfGimTLfBmSRcq5tGDz9MiaITmKJfgkocCoBujKlaog2GwNm8A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 497F61FDC0; Thu, 10 Mar 2022 06:20:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22A6K0Cc016930; Thu, 10 Mar 2022 06:20:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22A6K0Zm016914; Thu, 10 Mar 2022 06:20:00 GMT (envelope-from git) Date: Thu, 10 Mar 2022 06:20:00 GMT Message-Id: <202203100620.22A6K0Zm016914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: 7b45ad3f89cc - main - script -T skip timstamps for same second List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b45ad3f89cc4d65a23f7d034329dd3f8dd3105f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646893200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5z/rvgpvKhrwp9p1tQZQdg1U1NEA4D5GPtLOc2m2SWU=; b=G42TtJqh2PCISfbwrG68zsh5VOyVeT1BxAD5gdy//cozl6TsGmC9TkACK4cEBs/dj23TRH lmjqs87eNVKxH1rTRbn4Y9+82TlI3aDs8BYoPu8aXub0DhE3PrZbuenZATixgKdOQsoYRY SMjIscPEr71I5GJhdS9PpGQCGGRh89L3iGg3RqNRQBVG9a1zrbNkxHATCeGq471T4noMAO S62CjWUi/ccVRcMOvr9/mFdz3RaT0MVk9tXRM9RAWpB/kpNQZVxQMAXisA7K5fy2CCl4ER eG3heRGe9/7qt8UABp8GZTmftLSa/isK3y/1Kw5zYt+MHdSG3NFVTQiYi34FQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646893200; a=rsa-sha256; cv=none; b=CZzVWJxO1R3H/Tl1dcboIlxxFUE/7gQx4zF+ipEDAmH3C90O0y0OtsMdd/cQZ57NqN31oP osNRNEQPEFtV5PWWheM68z3YEOO/Y1ZdiWe1/mbQO4GkvXHDAbkl8xzBXPWB4XQs5AiAJo YoG+XArHze4DlsmnIM0cmM06lRQsEwG5Na2zONcBtHowYmf3b/+vzZsNvHZJM5Rnk60o9K cTPWEukZZicdxS4vUgpkcUNVZywzwkUQ6ideQGfQAa9KKD2A56UFuTtKAEJyUb0XbGTseG 6Q/bh78oaXlXAFKL234NQrPhd5HsRMNQoDS0hCzvHuM0U2Cwwws/lCRxzxZyPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7b45ad3f89cc4d65a23f7d034329dd3f8dd3105f commit 7b45ad3f89cc4d65a23f7d034329dd3f8dd3105f Author: Simon J. Gerraty AuthorDate: 2022-03-10 06:19:53 +0000 Commit: Simon J. Gerraty CommitDate: 2022-03-10 06:19:53 +0000 script -T skip timstamps for same second The result is much more readable if we only output the time-stamp when it is at least 1s since last one. --- usr.bin/script/script.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index 2e540a935ecd..e469b13fc65b 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -523,12 +523,14 @@ playback(FILE *fp) off_t nread, save_len; size_t l; time_t tclock; + time_t lclock; int reg; if (fstat(fileno(fp), &pst) == -1) err(1, "fstat failed"); reg = S_ISREG(pst.st_mode); + lclock = 0; for (nread = 0; !reg || nread < pst.st_size; nread += save_len) { if (fread(&stamp, sizeof(stamp), 1, fp) != 1) { @@ -574,9 +576,12 @@ playback(FILE *fp) if (tflg) { if (stamp.scr_len == 0) continue; - l = strftime(buf, sizeof buf, tstamp_fmt, - localtime(&tclock)); - (void)write(STDOUT_FILENO, buf, l); + if (tclock - lclock > 0) { + l = strftime(buf, sizeof buf, tstamp_fmt, + localtime(&tclock)); + (void)write(STDOUT_FILENO, buf, l); + } + lclock = tclock; } else { tsi.tv_sec = tso.tv_sec - tsi.tv_sec; tsi.tv_nsec = tso.tv_nsec - tsi.tv_nsec;