Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Use 'strftime' to calculate a date/time in the Past.

by daxim (Chaplain)
on Sep 18, 2012 at 07:32 UTC ( #994220=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Use 'strftime' to calculate a date/time in the Past.
in thread Use 'strftime' to calculate a date/time in the Past.

I would rather not have to install this module
Just do it. You're not really using Perl if you refuse to take advantage of modules. Dependencies are a good thing. You're likely afraid of change and overestimating the effort of installing, but with the right knowledge and tools it's easy. I don't want to go off-topic in this thread, so open a new question if you want further advice.
Is it not possible to do it with the current way I have the command?
No, there's only one Perl module distro that accurately calculates date and time, and that's the one I named. POSIX and Time::Piece offer only crude calculation and place the burden on the implementing programmer to get the details right, which is wrong because it always results in inaccuracy.
would I have to convert the "amount of time into the past" into all seconds … then subtract them
Sounds like a plan that can't go wrong… except you neglect to account for leap seconds. The magic number 86400 you used earlier is likewise flawed due to daylight saving time changing the length of a day.


Comment on Re^3: Use 'strftime' to calculate a date/time in the Past.
Re^4: Use 'strftime' to calculate a date/time in the Past.
by SBECK (Pilgrim) on Sep 18, 2012 at 15:57 UTC
      No, there's only one Perl module distro that accurately calculates date and time, and that's the one I named.

    I'm going to have to disagree with you there. Date::Manip will also calculate date and time accurately.

    I agree with your other points.
Re^4: Use 'strftime' to calculate a date/time in the Past.
by mmartin (Monk) on Sep 18, 2012 at 17:38 UTC
    Hey Daxim, thanks again for the reply...

    Yea I agree, it was just that I didn't want to go and install this Module on 40-50 different servers
    if I didn't have to. Ya know...?

    But actually, now that I'm thinking about it, I believe I do have that Perl Module... I think I just forgot
    to include the "use DateTime..." directive within the Perl command I was trying with your exmaple...


    Anyways, thanks again for all your help!


    Thanks Again,
    Matt


Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994220]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-09-15 09:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (146 votes), past polls