I can think of lots of times the output of 'time()' has been just what I
needed.  For example, anytime you want to compare times, like

my $timeout = time() + $sec_to_alarm;

do {
#stuff
} until (time() > $timeout);

Or to compare dates

$date = timelocal(@user_supplied_date);
$now = time();
if ($date == $now) {
#now
} elsif ($date > $now) {
#future date
} else {
#must've already happened
}

timelocal does the opposite of localtime, returning seconds since the epoch
for the localtime style date array.

Is this what you were after?

Peter C.
-----Original Message-----

I do like UNIX. I was just wondering what type of program would you write to
use that type of UNIX format?


Mike

"Jonathan e. paton" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I have a question. Why is it that I have to use 'scalar
> > localtime' to view a datetime in the proper format.
> > Why would I want to use the weird UNIX format that I
> > can't read?
>
> You don't, but Perl isn't stupid enough to impliement
> several dozen ways of displaying the date... not in the
> language proper anyway...
>
> There is several Date modules on CPAN:
>
> http://search.cpan.org/Catalog/Data_and_Data_Type/
> http://search.cpan.org/Catalog/Data_and_Data_Type/Date/
>
> In particular, the Date::Format module allows you to
> construct date strings in a format you prefer.  You can
> even output years in Roman numeral format.
>
> Since some complain of too many (varying) date modules, I
> can hardly understand your complaint.  Guess you ain't a
> UNIX lover... :(
>
> Jonathan Paton


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

Reply via email to