Hi,
I try to write a program that will executes a command on a specific time
inputted by a user. I don't know how you can compare the time of the user
with the computer clock ?
[snipped]
How can I compare two dates and find the difference?
If you're storing your dates as epoch seconds then simply
subtract one from the other. If you've got a structured date
(distinct year, day, month, hour, minute, seconds values), then
for reasons of accessibility, simplicity, and efficiency, merely
use either timelocal or timegm (from the Time::Local module in
the standard distribution) to reduce structured dates to epoch
seconds. However, if you don't know the precise format of your
dates, then you should probably use either of the Date::Manip
and Date::Calc modules from CPAN before you go hacking up your
own parsing routine to handle arbitrary date formats.
hope this helps