Written by J. Moellenkamp on
Reading time: 1 minute
More precise timestamps for DTrace
Sometimes the timestamps delivered by %Y are not precise enough for debugging purposes.
While this is still the default for compatibility reasons, you can now have much more precise timestamps with nanosecond resolution by using the -x timedecimals option. If you use this new option without an value it will give you the full precision
If you need less precise timestamps, you can control it by an optional value to -x timedecimals
If you use -x timedecimals=0 if will use 9 digits, not zero. If you chose a value higher than 9, it will revert to 9 as well.
If you only need higher precision in select outputs of you dtrace script there is a second way to get more digits by specifying it in the format string:
If you specify both, the precision specified in the format string has priority.
Despite having specified 4 decimals with -x timedecimals=4 it will use the number specified with "%.6Y".