CR1000 with OS29.
I'm getting a compiler warning when using this code:
Const localtime_c = False
Const timezoneoffset_c = -6 * 3600
Public bool As Boolean
'Main Program
BeginProg
Scan (1,Sec,0,0)
If TimeIntoInterval((IIF(localtime_c, 0, timezoneoffset_c / 3600) + 24) MOD 24, 24, Hr) Then bool = false Else bool = true
NextScan
EndProg
[Version]C:\Campbellsci\Lib\Compilers\CR1Comp.exe VERSION:CR1000.Std.29 DATE:02/16/2016
line 10: Warning: Parameter will truncate to the nearest integer.
line 10: Warning: Parameter will truncate to the nearest integer.
I understand it's just a warning but I use code like this multiple times and so I get around 16 warnings. The help says to declare these values as Long but I can't do that when using a constant. (with out declaring public variables and setting them equal to the constants).
Const localtime_c = False
Const timezoneoffset_c = -6 * 3600
Public bool As Boolean
Dim tempLong As Long
'Main Program
BeginProg
Scan (1,Sec,0,0)
tempLong = (IIF(localtime_c, 0, INT(timezoneoffset_c / 3600)) + 24) MOD 24
If TimeIntoInterval(tempLong, 24, Hr) Then bool = false Else bool = true
NextScan
EndProg
Just an FYI : with the next release of the OS you will be able to use the Ctype instruction as follows:
If TimeIntoInterval(Ctype((IIF(localtime_c, 0, timezoneoffset_c / 3600) + 24) MOD 24, long), 24, Hr) Then bool = false Else bool = true
Until then you will have to do as JDavis suggests and use the intermediate variable.