Hello, I use DateTime.Now to make decisions at different points within an application, but many times I see that the time has not changed since the last time I checked it.
In fact, in my case, it seems to change every 2 minutes and 11 seconds, just as if it were a discrete function, not a continuous function. Is this okay or am I doing something wrong?
My code is
In fact, in my case, it seems to change every 2 minutes and 11 seconds, just as if it were a discrete function, not a continuous function. Is this okay or am I doing something wrong?
My code is
B4X:
Sub Activity_Create(FirstTime As Boolean)
'...
Ticks=DateTime.Now 'Ticks takes the value of time when the program starts
dTime=Ticks 'dTime takes a copy o Ticks
...
Ens Sub
Sub DoSometing
dt=DateTime.Now 'checks time again
If dt> dTime Then 'if time changed
hh=DateTime.Gethour(dt-Ticks)
mm=DateTime.GetMinute(dt-Ticks)
ss=DateTime.Getsecond(dt-Ticks)
dTime=dt 'updates the check time
End if
End Sub