<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: UTC +-0.001 seconds in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598419#M1008317</link>
    <description>&lt;P&gt;Would it be fair to say that the obsession with coercion dots came from the CLD exam frowning upon them?&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2017 23:26:55 GMT</pubDate>
    <dc:creator>billko</dc:creator>
    <dc:date>2017-03-16T23:26:55Z</dc:date>
    <item>
      <title>UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598342#M1008277</link>
      <description>&lt;P&gt;This is a little bit of two things, one I want to figure out what is going on with this little snippet for curiosity sake and also, see if anyone has any better ways of dealing with this then the Goldbergian way I currently am.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a server that only returns timestamps in the specified text format and UTC time so I need a way of converting that to local time for ease of reading, so after faffing about for a bit I found the below, although it has an interesting problem, it loses 0.001 seconds on certain values.&lt;/P&gt;
&lt;P&gt;.256 = .255&lt;/P&gt;
&lt;P&gt;.257 = .256&lt;/P&gt;
&lt;P&gt;.258 = .258&lt;/P&gt;
&lt;P&gt;.259 = .259&lt;/P&gt;
&lt;P&gt;.260 = .259&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/b537fbb2dcac5b3ed17cfb4b778e8414684dbea1/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31393835353569323630384236413144353532313242312f696d6167652d73697a652f6f726967696e616c3f763d312e302670783d2d31" border="0" alt="UTC to local.png" title="UTC to local.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not a big deal as I'll never be working to that time accuracy, but just interesting. Let me know your thoughts.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 21:18:22 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598342#M1008277</guid>
      <dc:creator>ogk.nz</dc:creator>
      <dc:date>2017-03-16T21:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598351#M1008281</link>
      <description>&lt;P&gt;Can you show more decimal places on your indicators?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My thought is that timestamps are essentially a special variation of a floating point double precision.&amp;nbsp; You probably already know by now that not all numbers can be represented exactly in binary.&amp;nbsp; You may be running into this where the act of converting is not quite giving you the same result back due to the tiny errors in the resolution of floating point numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Beyond that, I'm not sure you need to do as much as you are doing to convert a time to appear in local time.&amp;nbsp; I just don't have the time (ha ha) at the moment to experiment with it.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 21:27:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598351#M1008281</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2017-03-16T21:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598358#M1008284</link>
      <description>&lt;P&gt;If you remove the two "to DBL" and subtract the two timestamps directly, things seem to work better. Try it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/170/1008284/1/Timepatch.png" border="0" alt="" title="" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 21:52:12 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598358#M1008284</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2017-03-16T21:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598384#M1008297</link>
      <description>&lt;P&gt;@Ravens&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/82a450ffc6901be90063454e0e09c07af7014df4/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31393835363469344445303536313745314235453743302f696d6167652d73697a652f6f726967696e616c3f763d312e302670783d2d31" border="0" alt="local time.png" title="local time.png" /&gt;&lt;/P&gt;
&lt;P&gt;I had tried using the Time version originally but it doesn't seem to work properly with DST for some reason, but I do feel like there must be a better way to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;@Altenbach&lt;/P&gt;
&lt;P&gt;It seems better, but oh do I not like the sight of coercion dots....&lt;/P&gt;
&lt;P&gt;Not sure which is the lesser of two evils here. And my understanding of coercion dots was that they indicated a hidden type conversion, so interestingly, its not the conversion to float itself, but simply the position of the float conversions.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 21:59:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598384#M1008297</guid>
      <dc:creator>ogk.nz</dc:creator>
      <dc:date>2017-03-16T21:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598400#M1008303</link>
      <description>&lt;P&gt;Well, coercion dots are &lt;STRONG&gt;not harmful&lt;/STRONG&gt;. If a coercion occurs, it does not matter if it is implicit or explicit. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(see also &lt;A href="https://ni.lithium.com/t5/LabVIEW/Dealing-with-Coercion-Dots/m-p/926925#M416411" target="_blank"&gt;this long discussion&lt;/A&gt; that shows that omitting explicit coercion (and thus having coercion dots!) is sometimes preferable. Go read it! I just added a link to our discussion :D)).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Back to the current problem, I had the crazy idea to tell it that the original time is in UTC (by replacing the "Z" with 00:00:00 or -00:00:00 and reading it with %z, but it obviously does not seem to work. Maybe I am doing it all wrong. This is not my field of expertise. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/170/1008303/1/TimeNOpatch.png" border="0" alt="" title="" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 23:00:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598400#M1008303</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2017-03-16T23:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598413#M1008312</link>
      <description>&lt;P&gt;Looking at your use of %z reminded me of something I saw once upon a time in the date format so I figured I might try it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replacing %&amp;lt; &amp;gt;T (Absolute time container) with %^&amp;lt; &amp;gt;T (Universal time container) results in the same reading as returns from the Seconds/Date-Time/Seconds conversion, off by an hour. So it looks like there is something about LV that doesn't quite handle the DST properly when going back and forth to UTC.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 23:18:14 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598413#M1008312</guid>
      <dc:creator>ogk.nz</dc:creator>
      <dc:date>2017-03-16T23:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598419#M1008317</link>
      <description>&lt;P&gt;Would it be fair to say that the obsession with coercion dots came from the CLD exam frowning upon them?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 23:26:55 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598419#M1008317</guid>
      <dc:creator>billko</dc:creator>
      <dc:date>2017-03-16T23:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598481#M1008333</link>
      <description>&lt;P&gt;Why wouldn't this work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Input string is assumed to be UTC.&amp;nbsp; It converts it to a timestamp which is assumed to be local time.&amp;nbsp; It also determines time zone, and adds that to the result, so the time in the time stamp indicator is now compensated t local time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do see one flaw with this.&amp;nbsp;&amp;nbsp; The DST shift could fail if UTC time is at a time that if it was local, time changed would have occurred, but it would subtract back to a point of time where the time change had not occurred yet in your local time.&amp;nbsp; So that would be a few hours in the spring and a few hours in the fall.&amp;nbsp; But with a bit more code to look at the time zone offset after the addition, the hour could be added back in or taken out.&amp;nbsp; (I did not include this scheme in the snippet.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still think there is another way that LabVIEW would handle this better based on format strings.&amp;nbsp; I'm just not sure how yet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/170/1008333/1/Example_VI.png" border="0" alt="" title="" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2017 04:51:45 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598481#M1008333</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2017-03-17T04:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598629#M1008382</link>
      <description>&lt;P&gt;Here is an alternate way to convert from local time to UTC time. I've used this call to the kernel for many years without any issues (at least through Windows 7). Just "add" the UTC offset to go from UTC time to Local. I don't know if this is any better/faster, but you only need to store one numeric value rather than doing a lot of string conversions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only issue I see is the same one RavensFan mentioned: If you make the call to the kernel just before DST changes (at 2am) you will still have the old offset value until you call the kernel again after 2am. This will only happen twice a year Nov 1 and March 3 (or not at all if you live in Arizona, Hawaii, Puerto Rico...)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I forgot where I got this code, so I apologize for not giving him/her credit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/40520bdd1646702a7ad87d8312e9431236a7e3d3/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31393836303369374632324335423732304135313744312f696d6167652d73697a652f6f726967696e616c3f763d312e302670783d2d31" border="0" alt="convert UTC_Local Time.png" title="convert UTC_Local Time.png" width="664" height="232" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2017 11:02:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598629#M1008382</guid>
      <dc:creator>jamiva</dc:creator>
      <dc:date>2017-03-17T11:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598715#M1008399</link>
      <description>&lt;P&gt;This is courtesy paul_cardinale:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/ef8c7bd55b07bae32707c685107f655e10cce02e/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31393233353569463341363936333936424237333030372f696d6167652d73697a652f6f726967696e616c3f763d312e302670783d2d31" border="0" alt="utc offset.png" title="utc offset.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This calculates the offset of local time from UTC.&amp;nbsp; It is fully DST compatible.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2017 14:17:05 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598715#M1008399</guid>
      <dc:creator>billko</dc:creator>
      <dc:date>2017-03-17T14:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598885#M1008470</link>
      <description>&lt;P&gt;Actually using %^&amp;lt;&amp;gt;T as format string container as mentioned by ogk.nz treats the string directly as UTC. However I found something else on my computer which sounds strange. I had to remove the %p format specifier and instead use the 24 hour clock here, in order for the Scan from String function not to return with error 1 (argument error). &amp;nbsp;Also using %p in a Format to String function produces an empty string.&lt;/P&gt;
&lt;P&gt;And for some reasons I seem not to be able to change the data and time format from the HH:mm:ss on my Windows 10 system. Maybe it's one of the settings our company feels should not be changed, after all who the heck still uses this pretty confusing AM/PM clock anymore?&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://ni.lithium.com/i/smilies/16x16_smiley-very-happy.gif" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But even changing the country setting from Netherlands to United States didn't seem to allow LabVIEW to use the %p format specifier on my computer. So definitely something else to consider for people who need their application to run in more countries than just their own.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/34a38291cc5b04ebbaa0e1ec464442573edb37bd/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31393836343169424432453033303343303642303937452f696d6167652d73697a652f6f726967696e616c3f763d312e302670783d2d31" border="0" alt="UTC Timestamp.png" title="UTC Timestamp.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2017 18:10:33 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598885#M1008470</guid>
      <dc:creator>rolfk</dc:creator>
      <dc:date>2017-03-17T18:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: UTC +-0.001 seconds</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598948#M1008490</link>
      <description>&lt;P&gt;This all sounds vaguely familiar.&amp;nbsp; I want to say some message from about a year ago.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder if I can come up with the right keywords and find it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT:&lt;/P&gt;
&lt;P&gt;Maybe this is it.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://ni.lithium.com/t5/LabVIEW/Scan-from-String-to-get-Timestamp-Problem-in-LV-2012/td-p/2755506" target="_blank"&gt;http://forums.ni.com/t5/LabVIEW/Scan-from-String-to-get-Timestamp-Problem-in-LV-2012/td-p/2755506&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason is seemed familiar is because it is one of the relatively few posts I started.&amp;nbsp; And it was actually about 2 years ago.&lt;/P&gt;
&lt;P&gt;It talks about errors in the time and scan from string functions, but related to 2 and 4 digit years, not AM/PM vs. 24 hour clock.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll have to keep looking to see if there is anything more directly related.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT #2:&lt;/P&gt;
&lt;P&gt;Found this from 6 years ago.&amp;nbsp; More relevant.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://forums.ni.com/t5/LabVIEW/scan-from-string-does-not-recognize-AM-PM-flag/td-p/1479438" target="_blank"&gt;http://forums.ni.com/t5/LabVIEW/scan-from-string-does-not-recognize-AM-PM-flag/td-p/1479438&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2017 20:46:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UTC-0-001-seconds/m-p/3598948#M1008490</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2017-03-17T20:46:06Z</dc:date>
    </item>
  </channel>
</rss>

