sulfericacid
Programmer
Ok everyone, I don't care how much help you give me on this one. If you have a premade script already, kudos for everyone!
I have a time saved in a hash which I want to compare with whatever the time; is now. time; is only done by seconds so I need a way for this script:
foreach (keys %db) {
my ($count, $ip, $oldtime) = split(/::/, $db{$_});
my $time=time;
my $elapsed = $time - $oldtime;
print $elapsed;
}
I have it count seconds which is great but not very useful. How can I get it to count upwards so it acts like this:
Display seconds unless elasped > 60
Display minutes unless elapsed > (60*60)
Display hours unless elapsed > (whatever 24hrs would be)
Display days until one week
Display week until month
Display number of months until year
Display year(s)
Basically I want it to get pushed up to the next interval of time then ignore the previous times. Like if it was 1 min and 20 seconds ago I want it to display 1 min, NOT 1 min 20 seconds. Or if it were 1 day, 23 hours, 22 minutes, 11 seconds, only display 1 day.
Can anyone spare a few minutes?
"Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid
I have a time saved in a hash which I want to compare with whatever the time; is now. time; is only done by seconds so I need a way for this script:
foreach (keys %db) {
my ($count, $ip, $oldtime) = split(/::/, $db{$_});
my $time=time;
my $elapsed = $time - $oldtime;
print $elapsed;
}
I have it count seconds which is great but not very useful. How can I get it to count upwards so it acts like this:
Display seconds unless elasped > 60
Display minutes unless elapsed > (60*60)
Display hours unless elapsed > (whatever 24hrs would be)
Display days until one week
Display week until month
Display number of months until year
Display year(s)
Basically I want it to get pushed up to the next interval of time then ignore the previous times. Like if it was 1 min and 20 seconds ago I want it to display 1 min, NOT 1 min 20 seconds. Or if it were 1 day, 23 hours, 22 minutes, 11 seconds, only display 1 day.
Can anyone spare a few minutes?
"Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid