PRETTYTIME.RC ScriptThe
PRETTYTIME alias is a method for converting raw seconds to a weeks/days/hours/minutes/seconds format.
How long is 654376 seconds?
654376 seconds is 1w 0d 13h 46m 16s
If you want to know in weeks, days, hours, minutes and seconds, the
PRETTYTIME.RC script will let you convert seconds into a more legible time format. It's not dissimilar to the $mp3time() function, but that is limited to minutes/seconds. This simplistic script is very easy to modify, and rather self-explanatory. I've played with the idea of adding months and years, but those are less specific units of time, and most of the things I ever want to convert are easily understood in terms of weeks anyway, or smaller units.
What would you use this for? Perhaps you want to see how long a ban period is, and you've used the
/admin banlist command to get your information. SlavaNap has a secondary method to retrieve this information, but you may be using an OpenNap server. Maybe you want to know how long an albw runs, or you have some other interest, such as parsing the number of seconds someone's been online using your own WHOIS hook.
For whatever reason, if you want to convert seconds to a more readable format, PRETTYTIME does an adequate job. The script contains no special characters, so it doesn't hurt to simply cut and paste this script. Save it as prettytime.rc wherever your default script folder is, load it and run it with the /prettytime alias.
Code:
# prettytime.rc v.1224168783 by SkyyTek
# Usage: /prettytime <seconds>
alias prettytime {
eval @ totaltime = $0
@ weeks = totaltime/604800
@ newtime = totaltime-(weeks*604800)
@ totaltime = newtime
@ days = totaltime/86400
@ newtime = totaltime-(days*86400)
@ totaltime = newtime
@ hours = totaltime/3600
@ newtime = totaltime-(hours*3600)
@ totaltime = newtime
@ minutes = totaltime/60
@ newtime = totaltime-(minutes*60)
@ seconds = newtime
eval xecho -b $0 seconds is $weeks\w $days\d $hours\h $minutes\m $seconds\s
}
You can substitute
eval xecho -b with just
eval echo if you want raw output without the banner. I use
EE as an alias for
EVAL ECHO as I use that combination so often. As I said, it's very easy to understand and modify this script.
Happy scripting!

SkyyTek
