On 4 Oct 2004 at 10:34, Kamal Ahmed wrote:

> I am trying to print time in a format HH:MM:SS.nnnnnn
> E.g. 08:06:26.464649
> 
> Any ideas how I can do it ?

  use Time::HiRes qw(gettimeofday);  

  ($epochseconds, $microseconds) = gettimeofday; 
  ($second, $minute, $hour) = localtime($epochseconds); 
  print sprintf("%02d:%02d:%02d.%06d %s", 
                $hour, $minute, $second, $microseconds);  

One caveat, Win32 systems do not appear to be able to give you 
anything smaller than milliseconds (the first three decimal places).


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to