timeInRange — checking if the present time hits the specified interval.
Description:
u8 timeInRange(HH:MM-HH:MM);
Checking if the the specified interval of time present time hits the interval HH:MM-HH:MM.
List of parameters:
HH:MM-HH:MM
Start time and end time of checked interval of time. Time is set in the format of HH:MM.
Return values:
· Returns 0 if the present time doesn’t hit the interval HH:MM-HH:MM.
· Returns the value not 0 if the present time hits the interval HH:MM-HH:MM.
Example:
<item addr="524:248" name="Test for timeInRange function" type="script"> V-ID/V-ADDR { if(opt0()) { u8 res = timeInRange(6:00-10:00); if(res != 0) { setStatus(@exciterId():32, {1, "Good morning!"}); } res = timeInRange(10:01-16:00); if(res != 0) { setStatus(@exciterId():32, {1, "Good afternoon!"}); } res = timeInRange(16:01-22:00); if(res != 0) { setStatus(@exciterId():32, {1, "Good evening!"}); } res = timeInRange(22:01-5:59); if(res != 0) { setStatus(@exciterId():32, {1, "Good night!"}); } } } </item>
The result of performing the example:
Depending on the time of day when clicking the element script the following messages will be displayed in the interface: “Good morning!”, “Good afternoon!”, “Good evening!” or “Good night!”.