I have a Perl program that gets the date of a file using 'ctime' from "use
Time::localtime;" But this program must also convert an
Epoch time to a date and time using 'localtime'
from "use Time::Local;". The
problem is it appears that only one of these modules can be used in a
single program. Not both since a localtime
subroutine exist as the same name in both modules. How can I support
using both modules in the same program?. Here are the snippits:
#!/usr/bin/perl
use Time:localtime;
use Time:Local;
#needs Time::Local
sub convertEPOCHtime ($) {
my $time = $_[0];
my ($seconds, $minutes, $hours, $day_of_month, $month,
$year, $wday, $yday, $isdst) = localtime
($time);
$year += 1900;
my @themonths =
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
my @weekdays = ("xxx", "Sat", "Sun", "Mon", "Tue", "Wed", "Thr",
"Fri", );
if ($hours < 10) {
$hours = '0' . "$hours";
}
my $datestring = "$weekdays[$wday] $themonths[$month] $day_of_month
${hours}:${minutes} $year";
return ($datestring);
}
# needs Time::localtime
sub FILEdate ($) {
my $filename = $_[0];
my $as_of_date = ctime(stat("$filename")->mtime);
return ($as_of_date);
}
--
Michael Barto
Software Architect
LogiQwest
Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA 92649
http://www.logiqwest.com/
[EMAIL PROTECTED]
Tel: 714 377 3705
Fax: 714 840 3937
Cell: 714 883 1949
'tis a gift to be
simple
This e-mail may contain
LogiQwest
proprietary information and should be treated as confidential.