Forum

Using Global DateTi...
 
Notifications
Clear all

Using Global DateTime

6 Posts
4 Users
0 Likes
3,515 Views
(@dgough)
New Member
Joined: 5 years ago
Posts: 1
Topic starter  

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: 5 years ago
Posts: 12
 

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 5 years ago by natebrews

   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

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


   
ReplyQuote
(@diebeerery)
Eminent Member
Joined: 6 years ago
Posts: 25
 

My global that works...

new datetime HLTpreheat

HLTpreheat = "05:00:00"

wait "HLTpreheat" <= now

 

 


   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

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: 6 years ago
Posts: 25
 

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


   
ReplyQuote
Share: