cik_ail has asked for the wisdom of the Perl Monks concerning the following question:

Pardon my ignorance, how do we calculate current time A in microseconds and then calculate current time B (differ from A) in microseconds and finally check the difference in microseconds??
$time_a = (current time in microseconds) $time_b = (after current time in microseconds) $time_c = $time_b - $time a (time in microseconds)
yes, i know there are function about this, but i still could see it properly..

Replies are listed 'Best First'.
Re: Simple time differences in microseconds
by cog (Parson) on Feb 23, 2005 at 11:01 UTC
Re: Simple time differences in microseconds
by Aristotle (Chancellor) on Feb 23, 2005 at 11:04 UTC

    And depending on what you want this for, you may want to investigate the Benchmark module.

    Makeshifts last the longest.

Re: Simple time differences in microseconds
by pearlie (Sexton) on Feb 23, 2005 at 11:25 UTC
    You can use Time::Local module to get current time and difference can be calculated using Date::Calc. Depends on your requirement of date-time formats and what you actually want to achieve by calculating the time difference.
      Tried it many times with Time::HiRes,
      fortunately, well it works,
      So, thanx.. The precision that i needed was in microsec anyway..