#timevalue()
DESCRIPTION
returns the time value for the given time (hh:mm:ss)
SYNOPSIS
#timevalue(i1,i2,i3)
ARGUMENTS
i1 - hour (0-23), or an integer expression resolving to an hour
i2 - minute (0-59), or an integer expression resolving to a minute
i3 - second (0-59), or an integer expression resolving to a second
EXAMPLES
# pikt +C 'output $text(#timevalue(0,0,0))'
0
# pikt +C 'output $text(#timevalue(1,0,0))'
3600
# pikt +C 'output $text(#timevalue(1,1,0))'
3660
# pikt +C 'output $text(#timevalue(1,1,3))'
3663
rule // parse the start time, set the reldur (real duration)
if #parse($sta, ":") == 2
set #stahr = #val($1)
set #stamn = #val($2)
else
set #stahr = 0
set #stamn = 0
fi
set #statv = #timevalue(#stahr, #stamn, 0)
if #statv
set #nowtv = #timevalue(#hour(), #minute(), #second())
else
set #nowtv = 0
fi
// for any start time parse failure, #reldur will be 0
set #reldur = #nowtv - #statv
rule // if it's been more than #hrs hours since the last piktd_log
// entry, piktd is not logging, hence appears to be hung/dead;
do #split($time, ":")
set #t = #datevalue(#yrnow - #if(#monnow == 1 && $mon eq "Dec", 1, 0),
#monthnumber($mon),
#date)
+ #timevalue(#val($[1]), #val($[2]), #val($[3]))
if #timenow - #t > #hrs*60*60
output mail "piktd appears to be hung/dead on $sys"
endif
SEE ALSO
#datevalue()
#hour()
#minute()
#now()
#second()
#today()
Numerical Functions
String Functions