What time is it, again?

The TIMESTAMP indicator is smart enough to get you into trouble.

Just ran into what at first appeared to be a bug, but turned out to be proper, if misunderstood, behavior.

I have a project which records data files. When the actual recording starts, and again when it stops, I remember the time (by using a GET DATE/TIME in SECONDS function) in a TIMESTAMP variable, which is stored in the data file. There might or might not be some calibration activity after the recording has stopped.  When the DONE button is finally clicked, I record the current time using a FORMAT DATE and TIME STRING function, into another string field called “TEST TIME”

I have a viewer which examines the data files and reports various info about them. The indicator that shows the TEST TIME is on a different window from the one that shows the START TIME and END TIME.

If there’s no CAL operations done, then the TEST TIME has always been just a few seconds later than the STOP time (enough time to react to the test being done and click the DONE button), or it could be a few minutes later.

However, I recently noticed that, on a data file sent from my client to me, that the TEST TIME was almost an hour EARLIER than the STOP time.  How could that be?  Further rummaging thru other files that I had from him shows the same thing: the TEST TIME was short of an hour EARLIER than the DONE time.  If there were CAL operations done, this difference was 45-55 minutes; if not, it was a few seconds short of an hour.

I have run thousands of tests on my machine without noticing this; my client has also run nearly a thousand, and has never brought it up.  Why is that?

There’s one piece of info missing from the above description that’s critical to figuring out what’s happening: My client is on CENTRAL time, while I am on EASTERN time.

It took a while to figure out what was really happening:  The TIMESTAMP value was being sent whole: encoded with that value somewhere must be the TIMEZONE that it was recorded in.  When the file crossed the timezone line, the value (as it was displayed to me) actually changed.  I confirmed this with my client; a given file showed a START time of 9:39:20 on his machine, but the same file showed a START time of 10:39:20 on my machine.  Of course, those are the exact same moments, just expressed in different time zones.

The TEST TIME, however was recorded as a STRING, and as such, has no mechanism for changing.

3 Responses to “What time is it, again?”

  1. Phillip Brooks says:

    When recording timestamps to a file, it is important to store complete timezone info. The most common format is ISO-8601.

    http://en.wikipedia.org/wiki/ISO_8601

  2. Steve says:

    Exactly. That is apparently what LabVIEW does, when recording true timestamp values.
    The same file with the same data will show 9:39 on one machine and 10:39 on another, because it is incorporating the timezone with it.

    When you record a string with the time though, you don’t get that benefit. And you won’t notice at all unless you cross timezones.

  3. Phillip Brooks says:

    On the LAVA forums, I just discovered what is probably the ideal format string for recording timestamp data in ISO-8601 UTC format:

    http://lavag.org/topic/15034-timestamp-support-for-format-into-string-scan-variant-from-string-string-package/page__view__findpost__p__90599

    %^T

Leave a Reply



Testimonial  Contact Info

207-593-8109

Culverson Software

184 Lakeview Drive

Rockland, ME 04841

General questions:

Sales@Culverson.com

Accounts/billing questions:

Accounts@Culverson.com


Logo