Returns 1 if the parameter year is a leap year.
<MvFUNCTION NAME
= "
isLeapYear"
PARAMETERS
= "
year"
STANDARDOUTPUTLEVEL
= ""
>
<MvASSIGN NAME
= "
l.LeapYear"
VALUE
= "
{ 0 }"
>
<MvIF EXPR
= "
{ (l.year MOD 4) EQ 0 }"
>
<MvASSIGN NAME
= "
l.LeapYear"
VALUE
= "
{ 1 }"
>
<MvIF EXPR
= "
{ (l.year MOD 100) EQ 0 }"
>
<MvIF EXPR
= "
{ (l.year MOD 400) }"
>
<MvASSIGN NAME
= "
l.LeapYear"
VALUE
= "
{ 0 }"
>
</MvIF>
</MvIF>
</MvIF>
<MvFUNCTIONRETURN VALUE
= "
{ l.LeapYear }"
>
</MvFUNCTION>
The following code will perform a "time delay", during which the program appears to do nothing. The value of the variable wait is the number of seconds to delay.
<MvFUNCTION NAME
= "
delay"
PARAMETERS
= "
wait"
STANDARDOUTPUTLEVEL
= ""
>
<MvASSIGN NAME
= "
l.stop"
VALUE
= "
{ s.dyn_time_t + l.wait}"
>
<MvWHILE EXPR
= "
{ s.dyn_time_t LE l.stop }"
>
</MvWHILE>
</MvFUNCTION>
The Time2Seconds(time_string) function below takes a time string in the form 'hh:mm:ss' and converts it to seconds: For example: the time '00:01:01' would return 61. The time '23:59:59' would return 86399.
<MvFUNCTION NAME
= "
Time2Seconds"
PARAMETERS
= "
time_str"
STANDARDOUTPUTLEVEL
= ""
>
<MvCOMMENT> Given a string 'hh:mm:ss' returns seconds ((hh * 3600) + (mm * 60) + (ss)) </MvCOMMENT>
<MvFUNCTIONRETURN VALUE
= "
{ (gettoken(l.time_str,':',1) * 3600) + (gettoken(l.time_str,':',2) * 60) + gettoken(l.time_str,':',3) }"
>
</MvFUNCTION>