LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Date/Time in Seconds timestamp losing an hour

I am using the 'Get Date/Time in Seconds' function in a loop with a shift register to calculate the amount of time between loop interations.  This is in a LV2012 exe running many hours each day.  On random occasions the timestamp coming out of the function loses an hour -- goes from say 3:12:13PM to 2:12:13PM (the date doesn't change).  Once it loses the hour it counts up normally from that point.  This started about 6 weeks ago and happens from a couple times a day to every couple of days. Has anyone ever seen something like this and how did you fix it?

0 Kudos
Message 1 of 12
(4,173 Views)

Can you post code?

 

Anything greater that 2012, I can't open.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 12
(4,162 Views)

The full program is rather involved, but I've reproduced the problem code in the attached (LV2012).  Finally figured out what was happening when I put some logging into the program to determine why the math using the time difference would shift.  We were able to capture the following transition:

last read time current read time time diff
3:28:48 PM 3:28:48 PM 0.100006
3:28:48 PM 2:28:49 PM -3599.9
2:28:49 PM 2:28:49 PM 0.100006
0 Kudos
Message 3 of 12
(4,142 Views)

That's strange. Since it is an exe this issue is problably more on the PC side. Any updates or modifications? Note that around  6 weeks ago there was the time change but since it run ok most of the time it's probably just a coincidence.

 

Ben64

0 Kudos
Message 4 of 12
(4,123 Views)
How long this example have to run before the problem? Same as the full application?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 12
(4,109 Views)

@ben64 wrote:

That's strange. Since it is an exe this issue is problably more on the PC side. Any updates or modifications? Note that around  6 weeks ago there was the time change but since it run ok most of the time it's probably just a coincidence.


My very first thought was "Didn't DST just end, which would cause the clock to go back an hour?"

 

The Get Date/Time function gets the time from the system clock.  I would be watching that.  Perhaps it is IT trying to set the time on you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 12
(4,098 Views)

Mike,

The sample doesn't exihibit the problem.  It is just to show how the function is used.  I have used code like this in dozens of applications over 10+ years and this is the only time I've seen anything like this.  On the machine that shows the problem, the client first said that it happened almost every time the program was running for about 30 minutes.  However, I don't think it is quite as repeatable as they thought since it took them four weeks of trying to capture a log with the event.  The log code was pretty simple and they were to start the log once they got close to the 30 minute time and then shut it off once they either saw the event or had run well over the 30 minute mark.  I didn't have the log constantly active because I didn't want to fill up the hard drive with log files.

0 Kudos
Message 7 of 12
(4,089 Views)

crossrulz,

I didn't think about IT trying to set the time.  I don't think this PC is on their network, but will check with them.

Thanks

0 Kudos
Message 8 of 12
(4,086 Views)

We normally set the timezone on any rig/measurement PCs to UTC and/or log the date/time in UTC to avoid these weird issues around timestamps being off by an hour!


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 9 of 12
(4,053 Views)

What version of Windows?  Does it occur after a shutdown of the computer? Does the BIOS clock interact with Windows clock?  Might be worth checking out.  

 

https://support.microsoft.com/en-us/kb/899855

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 10 of 12
(4,022 Views)