LabVIEW Timestamp Data to XML Showing Unexpected Values

Updated Sep 5, 2018

Reported In

Software

  • LabVIEW

Other

XML File Format

Issue Details

I cannot understand the time stamp values in my XML file generated with LabVIEW. I am just using the Flatten To XML String function to flatten my timestamp control and write it to a file:
But my XML data is not the total elapsed time since 1/1/1904 00:00:00.00 UTC as I expect:
 
Why is this happening?

Solution

The XML formatting of your timing should display the total elapsed time in seconds from 1/1/1904 00:00:00.00 UTC. 

The problem we're facing is that the Flatten to XML String converts your data into a signed, 32-bit value. The absolute max number for a signed 32-bit value is 2,147,483,647. Because any date after ~1974 will have a larger number of elapsed seconds (since 1/1/1904) than 2,147,483,647, we experience some sort of rollover, which is the data that's displayed in your XML file. 

Here is an equation we can use to account for our rollover: 
 
XML Elapsed Time = -[ MAX of U32 - (Total Elapsed Seconds - MAX of U32) ], 

where MAX of U32 is 2,147,483,647, and Total Elapsed seconds is the total number of elapsed seconds from 1/1/1904 00:00:00.00 UTC.

You can refer to the attached VI for an example of both rollover and this calculation.

WAS THIS ARTICLE HELPFUL?

Not Helpful