I’m reading and writing string-encoded UTC datetimes over OPC, and would like to use derived tags to both convert the strings to actual datetime types, while also offsetting them into the local timezone.
The read portion of this works fine, but when writing to the derived tag I get cryptic evaluation errors.
I have the following tags:
datetime_r - OPC - string
datetime_w - OPC - string
datetime_utc - Derived - DateTime - source is datetime_w
datetime - Derived - DateTime - source is datetime_utc
I don’t know if you figured this out. It doesn’t like the multiplication in the addHours part of the expression but if you wrap it in toInt() it will work. getTimezoneOffset returns a double while add hours is looking for an integer. When you do the multiplication it returns a double. Since addHours requires an int you got the error you showed.
To me I think it is a bug. I wouldn’t think being a regular int vs a double should stop it from working but that was the only thing I could see that it could be. Forcing it to an int got past the error though.
This also gets the expression error but if I add in the toInt it works fine. This takes away from my double vs int thought since I would assume -1 and 5 would both be looked at as int’s.