Time problems - Help!
- Hi Gang,
I'm trying to do something that should be relatively simple but can't get
there from here.
I'm trying to subtract a then date/time from a now date/time and print the
# the example below prints out -- "Program ran for 0"
Please what am I missing?
my $start_time = 0;
my $stop_time = 0;
my $diff_time = 0;
$start_time = localtime;
[BLOCK] # does something that takes < 1 min. to > 1 day
$stop_time = localtime;
$diff_time = $stop_time - $start_time;
Print "Program ran for: $diff_time\n";
[Non-text portions of this message have been removed]
- On Jan 27, John Drabinowicz said:
>I'm trying to subtract a then date/time from a now date/time and print theThen use time(), not localtime().
>$start_time = localtime;In scalar context, localtime() returns a string representing the current
day and time, not a number of seconds.
Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]