I want to print the time when starting the probe. After verifying the documents Dtrace I find the built-in variable: walltimestamp. And the Dtrace script likes this:
pid$1::func:entry
{
trace(walltimestamp);
}
But walltimestamp- "The current number of nanoseconds since 00:00 Coordinated universal time, January 1, 1970", so the output is like "1389583988106535481". I think this is not easy for the user to understand and want the output to be like "Mon Jan 13 00:00:00 2014". I searched if Dtrace provides type functions ctimein the C programming language, but nothing was found.
Does anyone need to implement a function like ctime? Or is there a better way to display time?
source
share