Skip site navigation (1)Skip section navigation (2)
Date:      12 Jul 2022 12:49:56 -0400
From:      "John Levine" <johnl@iecc.com>
To:        freebsd-questions@freebsd.org
Cc:        freebsd-doc@fjl.co.uk
Subject:   Re: How do get elapsed time in milliseconds in a shell script?
Message-ID:  <20220712164956.E1C884588F2D@ary.qy>
In-Reply-To: <4c98bb6d-a128-d10b-a896-6af11c06d41c@fjl.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
It appears that Frank Leonhardt <freebsd-doc@fjl.co.uk> said:
>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.

If you have perl installed, which most systems do, this should work:

$ perl -MTime::HiRes -e 'print Time::HiRes::time;'




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