Forum

Using Global DateTi...
 

Using Global DateTime  

  RSS

(@dgough)
New Member
Joined: 2 months ago
Posts: 1
March 10, 2019 7:41 pm  

I am trying to compare two Global DateTime values and the syntax I'm using isn't working.

Example:

[loop]
wait G_TimeDate value >= A_StartTime
LED state = on
sleep 1000
goto loop

This is the error i get:

[ERROR: Object reference not set to an instance of an object.]

 


Quote
(@natebrews)
Active Member
Joined: 4 months ago
Posts: 12
March 10, 2019 10:14 pm  

I also tried using the global variable datetime element.  I tried making one called TimeNow with the Variable Type "DateTime" and when I try to use it, I get errors. 

For example, when I tried doing 

new datetime o_t
new datetime othertime
o_t = TimeNow datetime
othertime = now
print o_t
print othertime

it doesn't work, and I get a "no property found with name datetime".  Commenting out the global parts, the "othertime" datetime variable prints fine.

However if I have TimeNow set to a Value (5) instead of DateTime I can do 

new value o_t
o_t = TimeNow value
print o_t

and it is fine, printing out "5". 

So I guess I'm confused on the use of datetime elements, or there is something else up.

This post was modified 2 months ago by natebrews

ReplyQuote
(@pbruno3)
Estimable Member Admin
Joined: 2 years ago
Posts: 235
March 10, 2019 11:07 pm  

Yes, this seems not to work. Let me investigate.


ReplyQuote
(@diebeerery)
Eminent Member
Joined: 9 months ago
Posts: 21
March 11, 2019 2:15 pm  

My global that works...

new datetime HLTpreheat

HLTpreheat = "05:00:00"

wait "HLTpreheat" <= now

 

 


ReplyQuote
(@pbruno3)
Estimable Member Admin
Joined: 2 years ago
Posts: 235
March 11, 2019 2:21 pm  

Thanks, but there is no reference to a global here. That variable is a local one (to the script it’s in). 


ReplyQuote
(@diebeerery)
Eminent Member
Joined: 9 months ago
Posts: 21
March 11, 2019 2:24 pm  

OH, my bad.. I didn't read enough. I was on the phone while browsing.. disregard.


ReplyQuote
Share: