These functions give you access to high-resolution timers. nimTimerDiff* will return the time since started, unless nimTimerStop() has been called, in which case it will return the time difference between start and stop.
my ($time) = nimTimerCreate();
nimTimerStart($time);
my ($diffMs) = nimTimerDiff($time);
print "$diffMs\n" # print difference between time and now in milliseconds
my ($diffSecond) = nimTimerDiffSec($time);
print "$diffSecond\n" # print difference between time and now in seconds.
nimTimerStop($time);
nimTimerFree($time);
Note: nimTimerFree seem broken on the Perl implementation (just re-create the timer).
Create a new time. Return a timer object.
Start a timer (not started automatically).
Stop a timer
Destroy memory allocation for the timer.
Return the difference between the timer start date and now in milliseconds.
Return the difference between the timer start date and now in seconds.