Octavian Rasnita wrote: > Hi, Hello,
> I have tried to find out the time a perl program runs, and I have used: > > #at the start of the program: > my $begin = (times)[0]; > my $begin_t = time(); > > ... The program follows > > # at the end of the program: > my $end = (times)[0] - $begin; > my $end_t = time() - $begin_t; > print "end: $end\nEnd_t: $end_t\n"; > > After running the program, it prints: > > end: 4.953 > End_t: 19 > > Why does this difference appear? time() is based on the time of your computers clock and it should change the same as the clock on your wall or the watch on your wrist. times() is based on the amount of time that that particular process runs on a particular CPU on your operating system while it is also running dozens of other processes. Note that times() in scalar context returns the same value as (times)[0] so the list slice is not really required. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>