printing time

Ryan Stone rysto32 at gmail.com
Thu Aug 28 16:56:59 UTC 2014


On Thu, Aug 28, 2014 at 10:52 AM, Kendrick, Stuart
<Stuart.Kendrick at emc.com> wrote:
> How else might I print a timestamp, other than using ‘printf … walltimestamp’?
>
> I’m running dtrace on a platform (modified version of FreeBSD 7) where ‘printf %Y’ only ever returns the one timestamp:  1969 Dec 31 18:00:00
>
> So I’m casting around for another approach:  suggestions?

Do you need wall clock time, or do you just need relative timestamps
to other dtrace prints?  timestamp works in all FreeBSD versions and
you can print it as a simple int.  The counter is given in nanoseconds
(I believe that it's specifically the number of nanoseconds since
boot, but don't quote me on that).

Alternatively, the code to implement walltimestamp was quite simple,
so you could investigate back-porting that:

http://svn.freebsd.org/changeset/base/238537


More information about the freebsd-dtrace mailing list