Reputation: 2092
After placing Timestamp control on my panel, I've changed it's properties to display only time, as I don't need date part.
Value shown on this control is, as expected, 00:00:00
, but if I press up button I get 01:00:01
, 01:00:02
, ..., or if I press down button, I get 00:59:59
, 00:59:58
and so on.
If I write 01:00:00
inside a text box of the control, it automatically switches back to 00:00:00
.
If I change timestamp value to double, I get 0
for 00:00:00
, -1
for 00:59:59
, and 1
for 1:00:01
.
So it seems as if this control uses 01:00:00 as a base time. Inside it's properties I've found minimum value of 01:00:00,000 1600-01-01
. Changing it to 00:00:00
doesn't give expected result.
Is there any way for this control to work properly as a normal time span control ?
Upvotes: 2
Views: 1122
Reputation: 2276
I don't know if the behavior is correct or not, but I can explain it.
The problem is that you're using absolute time. In absolute time, LV uses the first midnight of 1904 UTC as the epoch (the zero value) and when you have that value it displays it as all zeros. Once you change it, the display goes back to normal. The reason you're seeing 1:00:00 as the base is because you're in the GMT+1 timezone and LV automatically fixes the display when the value is not zero.
What I would suggest is replacing the timestamp control with a numeric control, going to the format page in the properties and changing the control to display relative time. Alternatively, if you do want the time to be absolute, then set the value of the control to the correct timestamp using a local variable before starting.
Upvotes: 4