38 lines
629 B
Modula-2
38 lines
629 B
Modula-2
#script=getuptime
|
|
// purpose: pseuwow uptime counter
|
|
// args: @def: "say", "yell", "chan,General", etc. any command that accepts a string in @def and does something with it.
|
|
|
|
// returns: uptime formatted as 0h 0m 0s
|
|
|
|
set,s ${@clock}
|
|
div,s 1000
|
|
set,s ?{toint ${s}}
|
|
set,secs ${s}
|
|
|
|
set,h ${s}
|
|
div,h 3600
|
|
toint,h ${h}
|
|
mod,s 3600
|
|
|
|
set,m ${s}
|
|
div,m 60
|
|
toint,m ${m}
|
|
mod,s 60
|
|
toint,s ${s}
|
|
set,str ${h}h ${m}m ${s}s
|
|
out UPTIME: ${secs} secs = ${str}
|
|
|
|
if ?{strlen ${@def}}
|
|
${@def} UPTIME: ${h} hours, ${m} minutes, ${s} seconds
|
|
endif
|
|
|
|
unset h
|
|
unset m
|
|
unset s
|
|
unset secs
|
|
|
|
return ${str}
|
|
|
|
#script=uptime
|
|
#permission=0
|
|
return ?{getuptime say} |