RE: hours minutes and seconds in seconds

2002-09-06 Thread Nikola Janceski

http://search.cpan.org/author/MSERGEANT/Time-Object-1.00/Seconds.pm

that can do it too.

 -Original Message-
 From: Rob [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 06, 2002 1:19 PM
 To: [EMAIL PROTECTED]
 Subject: hours minutes and seconds in seconds
 
 
 I'm working on a script that parses a log file which gives 
 connection time
 in seconds.  Below is how I resolved the problem but I think 
 there must be
 a better way?
 
 #!/usr/bin/perl -w
 
 use strict;
 
 my $sessionTime = 4000;
 
 my $hour = $sessionTime / 3600;
 my $hr = int($hour);
 $sessionTime = $sessionTime - ($hr * 3600);
 my $minute = $sessionTime / 60;
 my $min = int($minute);
 my $sec = $sessionTime - ($min * 60);
 print $hr hour $min minutes and $sec seconds.\n
 
 
 Rob
 
 Good judgement comes from experience, and experience -
 well, that comes from poor judgement.
 
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: hours minutes and seconds in seconds

2002-09-06 Thread John W. Krahn

Rob wrote:
 
 I'm working on a script that parses a log file which gives connection time
 in seconds.  Below is how I resolved the problem but I think there must be
 a better way?
 
 #!/usr/bin/perl -w
 
 use strict;
 
 my $sessionTime = 4000;
 
 my $hour = $sessionTime / 3600;
 my $hr = int($hour);
 $sessionTime = $sessionTime - ($hr * 3600);
 my $minute = $sessionTime / 60;
 my $min = int($minute);
 my $sec = $sessionTime - ($min * 60);
 print $hr hour $min minutes and $sec seconds.\n


If you only need hours, minutes and seconds then this will work:

$ perl -e'$t = 4_000; ($s,$m,$h) = gmtime( $t ); print Hour: $h\nMin:
$m\nSec: $s\n'
Hour: 1
Min: 6
Sec: 40



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]