Hi there
Is it posible to "calculate" the time when TimeIntoInterval(0,120,sec) is true ?
If you modulo the number of seconds into the day by 120 and the result is 0 then the statement is true.
If (Seconds_Into_The_Day) MOD 120 = 0
In other words
(midnight) --->
00:00:00, 00:02:00, 00:04:00, 00:06:00 ...
thanks
MortenS,
Where you hoping that it did something different? If so, maybe we can help point out a solution.
Dear Sam
My intention was to know the time (timestap) when TimeIntoInterval(0,120,sec) happens in the future.
/Morten
Sam's rules are correct, but a couple of extra details. The time used is the time of the start of the scan, plus the function will only return true once at the start of the period when the time condition is met, e.g. with a one sec scan rate, 0 into a 5 min period is set once every 5 mins not 60 times at the beginning of a 5 min period.
Two potential methods for looking at when the next interval is going to happen. Could mix and match some of the concepts if needed.
Const Interval = 120 'seconds
Public SS90 As Long
Public NextSS90 As Long
Public NextDate As String * 23
DataTable (TimeTable,True,1)
TableHide
Sample (1,NextSS90,Nsec)
EndTable
BeginProg
Scan (1,Sec,0,0)
If TimeIntoInterval (0,Interval,Sec) Then
SS90 = Public.Timestamp(1,1)
NextSS90 = SS90 + 120
CallTable (TimeTable)
NextDate = TimeTable.NextSS90(4,1)
EndIf
NextScan
EndProg
------------------------------------------
Const Interval = 120 'seconds
Public SecTilNext As Long
BeginProg
Scan (1,Sec,0,0)
SecTilNext = Interval - (Public.Timestamp(4,1) MOD Interval)
If TimeIntoInterval (0,Interval,Sec) Then
'do something
EndIf
NextScan
EndProg
Hi Sam
A mix of those did the job
Const Interval = 120 'seconds
Public SS90 As Long
Public NextSS90 As Long
Public NextDate As String * 23
Public SecTilNext As Long
DataTable (TimeTable,True,1)
Sample (1,NextSS90,Nsec)
EndTable
BeginProg
Scan (1,Sec,0,0)
SecTilNext = Interval - (Public.Timestamp(1,1) MOD Interval)
NextSS90 = Public.Timestamp(1,1) + SecTilNext
CallTable (TimeTable)
NextDate = TimeTable.NextSS90(1,1)
NextScan
EndProg
Thanks