Comparitive times


#1

1) Give a description of the problem
Comparison between Times

2) What is the expected behavior?
As above

3) What is happening/not happening?
Not giving a correct variable return from the comparitive times

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
01/01/2018, 23:51:06 +795ms +0ms ╔Received event [Home].execute = :958548d202f5e178b0e3d5ce2a572757: with a delay of 40ms +106ms ║RunTime Analysis CS > 15ms > PS > 31ms > PE > 61ms > CE +108ms ║Runtime (36976 bytes) successfully initialized in 31ms (v0.2.101.20171227) (107ms) +109ms ║╔Execution stage started +122ms ║║Comparison (time) 57066909 is_between (time) 60000 .. (time) 57600000 = true (6ms) +123ms ║║Time restriction check passed +124ms ║║Condition #3 evaluated true (10ms) +125ms ║║Cancelling statement #3's schedules... +129ms ║║Requesting time schedule wake up at Mon, Jan 1 2018 @ 4:00:00 PM PST +131ms ║║Condition group #1 evaluated true (state did not change) (17ms) +133ms ║║Cancelling statement #9's schedules... +137ms ║║Executed virtual command setVariable (1ms) +139ms ║╚Execution stage complete. (30ms) +141ms ║Setting up scheduled job for Mon, Jan 1 2018 @ 4:00:00 PM PST (in 533.065s) +149ms ╚Event processed successfully (150ms)

Hi all.
I’m a novice who started today, but please don’t think I have not tried to google or figure this out. I hate asking.

Anyway I understand the whole UTC time and how time is portayed in the logs however I have set the time (I assume this is correct) between 12.01AM (60000) and 4PM (57600000) with a simple program above, however the comparitive time 57066909 does not match the current time (currently taken just before midnight)

I figure there some programing faux pas I’m commiting, please be gentle.

Many thanks


#2

Try setting up the piston where the trigger is not your start and end time and see if it works better.

Something like…

every 2 minutes
  if time is between 0001 and 1600
  then
    set variable @schedule = true
  else
    set variable @schedule = false
  end if
end every

#3

thank you, Im a little stuck how to structure your intentions above. I will keep trying


#4

I have a test piston, will post when I get back to a PC.

See if this works. Modify the times as needed. Also, you might need to enable advanced statements under options.

This is just an example of what I was referring to as different trigger.


#5

Hi eibyer
Brill, Thanks for your help.

I had not realised there were advance statements, It’s opened up a whole new world for me.

The log still shows the

02/01/2018, 02:16:26 +97ms
+1ms ╔Received event [Home].time = 1514859387010 with a delay of -913ms
+108ms ║RunTime Analysis CS > 12ms > PS > 32ms > PE > 63ms > CE
+110ms ║Runtime (37490 bytes) successfully initialized in 32ms (v0.2.101.20171227) (109ms)
+111ms ║╔Execution stage started
+131ms ║║Comparison (time) 65786219 is_between (time) 0 … (time) 43200000 = false (6ms)
+132ms ║║Condition #7 evaluated false (10ms)
+133ms ║║Condition group #2 evaluated false (state did not change) (12ms)
+135ms ║║Cancelling statement #3’s schedules…
+139ms ║║Executed virtual command setVariable (1ms)
+143ms ║╚Execution stage complete. (31ms)
+144ms ║Setting up scheduled job for Mon, Jan 1 2018 @ 6:17:27 PM PST (in 60.77s)
+151ms ╚Event processed successfully (150ms)
02/01/2018, 02:15:26 +109m

I have set time between 00:00 and 12:00 (no days) and it still triggers false.

Is there a reason why my time is displayed differently to your example>


#6

I noticed the time display earlier but didn’t really pay much attention to it, now I’m curious why it formats differently on yours.

Edit: Back to your piston example… I think the result is correct since current time is not between midnight and 12pm? At least that’s how I’m interpreting that.


#7

of course. I shall build on that.

Many thanks again

I think I found the issue.
My location was not set correctly, therefore was set on PST.

02/01/2018, 03:14:42 +101ms
+7ms ╔Received event [Home].time = 1514862883122 with a delay of -1022ms
+144ms ║RunTime Analysis CS > 34ms > PS > 32ms > PE > 73ms > CE
+150ms ║Runtime (38160 bytes) successfully initialized in 32ms (v0.2.101.20171227) (141ms)
+154ms ║╔Execution stage started
+213ms ║║Comparison (time) 11682279 is_between (time) 0 … (time) 43200000 = true (19ms)
+215ms ║║Time restriction check passed
+221ms ║║Condition #7 evaluated true (47ms)
+223ms ║║Condition group #2 evaluated true (state did not change) (54ms)
+229ms ║║Cancelling statement #5’s schedules…
+247ms ║║Executed virtual command setVariable (10ms)
+277ms ║║Executed virtual command sendPushNotification (23ms)
+281ms ║╚Execution stage complete. (130ms)
+289ms ║Setting up scheduled job for Tue, Jan 2 2018 @ 3:15:43 AM GMT (in 60.739s)
+296ms ╚Event processed successfully (296ms)

The extra settings will really help now