From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format Date/Time String, Seconds to Date Time and Format to String VIs not respecting UK Daylight Savings Time on Real-Time

Hello

 

I appear to be experiencing some issues with my Real-Time PXI (PharLap) with respect to the change in daylight savings time here in the UK.

 

The behaviour is as follows:

 

the "Get Date/Time in Seconds.vi" shows the correct local time and day always (via a front panel indicator) - it even respects the exact moment of change so that at 01:59 British Summer Time +60 seconds on the 27th of November 2013, it starts displaying in GMT (which is equal to UTC). This is perfect.

 

However, it appears that any VI that converts this time to a string/cluster of time components will display the time as though daylight savings is still in effect until the end of US daylight savings time (on the 3rd November 2013).

 

I have tried this fix but to no avail: http://digital.ni.com/public.nsf/allkb/7E5CB910B1685C8B8625731A005FCB62

 

If it just didn't work I would accept it but the fact that some of the timing VIs handle daylight savings correctly according to time zone and others do not is very strange.

 

I have attached a VI to be run on a Real-Time PXI which hopefully demonstrates the problems that I have been experiencing and any suggestions of what to do would be greatly received.

 

I have also included a screenshot of the front panel with the results I get when I run it.

 

Development PC:

LabVIEW Professional Development System (version 12.0.1f5 32-bit) on windows 7 64-bit

RT PXI:

PXI-8196 Controller in PXI-1042 Chassis, Running LabVIEW Real-Time 12.0.1

Download All
0 Kudos
Message 1 of 7
(4,074 Views)

So according to this:

 

http://digital.ni.com/public.nsf/allkb/E9D08C9F795FF49F86256F9000040DC9

 


If you are using Get Date/Time in Seconds from the Timing palette, you are likely using a Time Stamp indicator to display the time on the front panel as it is the default data type of the function.


This can cause the time of the Real-Time controller to be displayed in the time zone of your host computer rather than its own time zone. Because the front panels of all real-time applications reside on the host computer, a Time Stamp indicator will reference the time zone of the computer LabVIEW is running on, rather than that of the Real-Time Target. The Time Stamp will then automatically convert the date and time so the user can view the time in their own time zone.


That would explain why the time appears to be displayed correctly in indicator from the Get Date/Time in seconds.

 

After making the modifications to my VI, I can see that the Get Date/Time in Seconds is also providing the wrong time after British Summer Time ends.

 

So it appears that the PXI is using the US dates for daylight savings time.

 

I have checked that the nt-rt.ini file contains the following:

 

RTTarget.TimeZone="GMT0BST"
RTTarget.DSTRule="3.5.0.2:0,10.5.0.2:0

 

So any suggestions as to how I can make the PXI use the UK daylight savings dates?

 

Cheers

 

John

 

0 Kudos
Message 2 of 7
(4,050 Views)

Having re-considered the fix from: http://digital.ni.com/public.nsf/allkb/7E5CB910B1685C8B8625731A005FCB62

it appears that I misunderstood how it works. I now believe that it requires you to manually check if you are in daylight savings time using the "is DST.vi" in the zip.

 

As this is something that I will potentially have to do quite often, I thought it best to produce a custom set of VIs that can determine the time for the UK that does not involve reading the ni-rt.ini file.

 

I have attached a zip containing these files (LV 2012) so hopefully they will be of some use to others.

 

Cheers

 

John

 

 

0 Kudos
Message 3 of 7
(4,034 Views)

I noticed some mistakes in my UK Time VIs. Here are the VIs with the required modifications.

0 Kudos
Message 4 of 7
(4,015 Views)

The PXI (and all LabVIEW) timestamps are UTC. 

 

http://www.ni.com/white-paper/7900/en/

 

UTC has no adjustments for daylight savings.

 

http://en.wikipedia.org/wiki/Coordinated_Universal_Time#Daylight_saving

 

The presentation of the timestamp is dependent upon your OS and OS settings. 

 

http://forums.ni.com/t5/LabVIEW/How-to-get-correct-timestamps-on-RT-controllers/m-p/2100608#M684619

 


 

I would remove the the custom setting of the RT timezone and use the default (UTC). The host VI and computer should present the timestamp using the local settings which should automatically handle DST.

 

 

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 5 of 7
(4,010 Views)

Hello Philip

 

Thank you for your helpful links.

 

My Real-Time application is required to take certain actions at midnight local time. This means that we were relying on the PXI's time zone settings to make these actions happen at 00:000 UTC during autumn/winter and 23:00 UTC during spring/summer.

 

When we were converting from a timestamp into a "date time rec" cluster (using the Seconds to Date/Time VI) we would set the "to UTC?" input to false, to make the result take account of the DST rules in operation.

 

Unfortunately, the rules for the PXI on daylight savings time do not appear to be correct for the UK time zone. This meant that the code would not work how we wanted.

 

This matter was further complicated by the fact that we were not aware that when running the code for debugging, the Host PC's time zone rules are enforced (unless you force the display to be in UTC) - so the DST settings appeared to be correct.

 

After becoming aware of exactly what was happening, it was possible to write some code that can determine when daylight savings time is in effect for the UK and hence determine when the local midnight is.

 

In an ideal world, everything would be UTC, but until that day, I guess we have to work around it.

 

Cheers

 

John

Message 6 of 7
(3,997 Views)

@John_Neutron wrote:

 

My Real-Time application is required to take certain actions at midnight local time. This means that we were relying on the PXI's time zone settings to make these actions happen at 00:000 UTC during autumn/winter and 23:00 UTC during spring/summer.

 


We return to standard time in the US this weekend. Monday could be fun...


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 7 of 7
(3,963 Views)