From nobody Mon Jul 18 13:45:22 2022 X-Original-To: freebsd-questions@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 4LmjsD08tqz4TCs2 for ; Mon, 18 Jul 2022 13:45:36 +0000 (UTC) (envelope-from tom.browder@gmail.com) Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LmjsC0rt5z40tf for ; Mon, 18 Jul 2022 13:45:35 +0000 (UTC) (envelope-from tom.browder@gmail.com) Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-10d4691a687so8441081fac.10 for ; Mon, 18 Jul 2022 06:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LMbncOlHlkYfy05TUjzL64ZiO48alWnKTk54p4t+buQ=; b=qNGzw1X2IEaiKjJpMtWeN8YS6otctodqs2T9q6/NWaqAFVgvwxi313QwRFG26nYwrX dIEC4WNdUeLv1uUnmeFA6GjSqfOW0pa6iaIgWZRXtWrUdCEPCiIngsNShUlmvfOOo7qd us7WurEUCkoGxHnEWcxGNlT2RYgUh+ZtbPKjisa6VyBHZME349QGkU28naDzkC28/xa/ 1x3xnRGFmSuSpBwJvolkD90PYeiANUzY/J1N7ydZVNH5ZGHjnR9cxyTFIYtYGn1Rfeve bmJL7gjU/gFh8ohRD97yHE92DnGLkttpYaIGYnnPQoEhp9wonisW651mytSX6YdTCVtV cfGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LMbncOlHlkYfy05TUjzL64ZiO48alWnKTk54p4t+buQ=; b=rgCCaBCOwX7WFDeRPqqLlCu1B2HoTsiQdav4gbHlvL94i8vUNZOsIoBtElmymN8yEW Nn8Ghh1/qI72UAu85dvP5BYu3wVVzGlGGmKfjU5pwbkv9X61FnO+6M4N8CUAyCCmn4lN pUPYBbEjipgvMgDPOFaYXGUrpCZZ58bKk5QV0iHQXGFegBjRWeUyT/fWaMSvgA5+rKTi W02qfsKyDBU1frajjRgbsLlIZlDgGnaoYe2FSirlvf2WSH+kF/l8wksFI3pGC6aGJqVg jaoLXfQhIH0q0FvACw6CSKKAkwII1oPACy7197T1wiSPVzUdky84VlnL/maY7/AQB65w fW3A== X-Gm-Message-State: AJIora+Twi5GCjMn4xueKDXJE3Qcau4H9Mx39/MEvybAGyg0lZS6s1eQ Aij7iQAiLBYsZ2OSYmsuVbh3Yzrst3Whl1imM7KCSvf4 X-Google-Smtp-Source: AGRyM1ttV6n53zCtsU0Fvg81kFkCun/8z+iWd+JTud4OFByuU283nt6NYxi9kRkuySveJLgkdhu0i7e/WM8ekfGKze0= X-Received: by 2002:a05:6808:21a9:b0:335:a978:c1d with SMTP id be41-20020a05680821a900b00335a9780c1dmr15810607oib.43.1658151934199; Mon, 18 Jul 2022 06:45:34 -0700 (PDT) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 References: <4c98bb6d-a128-d10b-a896-6af11c06d41c@fjl.co.uk> In-Reply-To: <4c98bb6d-a128-d10b-a896-6af11c06d41c@fjl.co.uk> From: Tom Browder Date: Mon, 18 Jul 2022 08:45:22 -0500 Message-ID: Subject: Re: How do get elapsed time in milliseconds in a shell script? To: Frank Leonhardt Cc: freebsd-questions@freebsd.org Content-Type: multipart/alternative; boundary="000000000000058e2d05e41495a6" X-Rspamd-Queue-Id: 4LmjsC0rt5z40tf X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=qNGzw1X2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of tom.browder@gmail.com designates 2001:4860:4864:20::2d as permitted sender) smtp.mailfrom=tom.browder@gmail.com X-Spamd-Result: default: False [-2.90 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.998]; NEURAL_HAM_MEDIUM(-0.99)[-0.992]; NEURAL_HAM_LONG(-0.91)[-0.911]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2001:4860:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2001:4860:4864:20::2d:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; ARC_NA(0.00)[]; TAGGED_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-questions@freebsd.org]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2001:4860:4864::/48, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --000000000000058e2d05e41495a6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jul 12, 2022 at 03:09 Frank Leonhardt wrote= : > I thought this would be easy, but it's not! > > I can get the time since the epoch to the nearest second (date +%s), but > nothing more accurate. This was probably good enough in the 1970s but I > think it's reasonable to want a better resolution even in a shell script. I=E2=80=99m a wannabe FreeBSD user lurking here. Can you tell us more about= your use case? (Spoiler alert: I=E2=80=99m a long time Unix/Linux user who now relies mos= tly on Raku for other than very simple bash scripts.) Best regards, -Tom --000000000000058e2d05e41495a6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, Jul 12, 2022 at 03:09 Frank Leonhardt <freebsd-doc@fjl.co.uk> wrote:
<= /div>
I thought this would be easy, but it= 9;s not!

I can get the time since the epoch to the nearest second (date +%s), but nothing more accurate. This was probably good enough in the 1970s but I think it's reasonable to want a better resolution even in a shell scrip= t.

I=E2=80=99m a = wannabe FreeBSD user lurking here. Can you tell us more about your use case= ?

(Spoiler alert: =C2=A0= I=E2=80=99m a long time Unix/Linux user who now relies mostly on Raku for o= ther than very simple bash scripts.)

Best regards,

-Tom
--000000000000058e2d05e41495a6--