I tried your command but it seems I don't have the Perl Module "DateTime.pm" installed on my machine.
And this command which is a part of a script I'm writing will be ran on a number of different servers,
alot of which are AIX and SLES servers which I would rather not have to install this module on every
Is it not possible to do it with the current way I have the command? Because that original command worked
on all the servers I tested it on.
I was thinking that to use my original command, would I have to convert the "amount of time into the past" into
i.e. If I want 2 days, 12 hours, 57 min, and 36 seconds into the past would I just convert each of those into
seconds then subtract them by "time", like in the "gmtime(...)" part of the command?
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.
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...