[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Perl date comparisons



At 2:58 PM -0800 11/16/98, Aiken, Greg wrote:

} I know that 'time()' returns the number of elapsed seconds between
} 01-01-1970 and the instant the function is called.

No, in MacPerl it doesn't.  It returns the elapsed time between the Mac
zero of time, midnight Jan 1 1904 localtime, and the present, in seconds.

} If however, one
} wanted to compare two points in time in Perl, it would appear to me that
} Perl would need to provide the following function:
}
}    elapsed_seconds_between_01-01-70_and_user_specified_date/time('yyyy-mm-
} dd hh:mm:ss');
}
} Unless this function exists, how would one accurately perform the
} comparison?  I've tried to call 'time()' passing in dates, but nothing
} seems to happen, and I can not find any documentation indicating what
} type of parameter, if any, 'time' accepts.

It doesn't accept any.  You want to look at the following with Shuck:
localtime (under Builtin Functions),  timelocal (in Time::Local, in your
MacPerl lib folder), and at the various time routines in the POSIX module.

You also want to go to CPAN <http://www.cpan.org/> and look around.  There
are alot of CPAN modules to deal with dates and time.  Most will work under
MacPerl.

}
} Yes, I realize I could 'hack' at this function myself.  But there are
} probably enough special rules (ie; leap years - unless evenly divided by
} 100, daylight savings, etc...) that I would not be knowledgeable about -
} that my seconds surely would not match the seconds returned by 'time()'.
}  Any help would be appreciated.
}



-----
Paul J. Schinder
schinder@pobox.com

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch