OpcUa_DateTime / FILETIME / leap seconds

Unified Architecture topics related to OPC UA Specification, compliant behavior and any technical issues of OPC UA, like Security, Information Model, Companion Specs DI, PLCopen, ADI, ...

Moderator: Support Team

Post Reply
Jr. Member
Jr. Member
Posts: 1
Joined: 03 Feb 2021, 16:03

OpcUa_DateTime / FILETIME / leap seconds

Post by KeithWood »

OpcUa_DateTime is described as "the same as the WIN32 FILETIME type" (units of 100 nanoseconds since 1601).

Unfortunately, Microsoft have changed the definition of FILETIME. See:

Until now, there have not been any leap seconds since this change was introduced, so the change is academic. However, any future leap seconds WILL be counted by FILETIME on Windows 10 (& Server 2019) & later. Older OS will continue with the original FILETIME definition - so as soon as the next leap second occurs, old & new Windows OS will count FILETIME differently. And for those new Windows OS user who want the old behaviour this can be achieved via a registry key.

The full details of the above are not really the important point. The important point is that FILETIME values are currently unambiguous - given a particular value everybody will agree what it means - but as soon as the next leap second occurs then different users will disagree - and that can't be good.

And once FILETIME is ambiguous, what does that mean for OpcUa_DateTime?

At the moment it is academic. There definitely will NOT be a leap second on 30 June 2021. It may be some time before the next one. Apparently the Earth has recently sped up slightly - so the next leap second may even been negative, rather than positive - but regardless of direction, as soon as one occurs, FILETIME becomes ambiguous.

I am aware there are proposals to abolish leap seconds altogether - but that conversation has been ongoing for some time, and has been deferred at meetings in 2003, 2005, 2012 & 2015 - with the next discussion (& probable repeat deferral!) scheduled for 2023. So it would be head-in-sand to suggest this is how the problem will be avoided.

User avatar
Support Team
Hero Member
Hero Member
Posts: 2670
Joined: 18 Mar 2011, 15:09

Re: OpcUa_DateTime / FILETIME / leap seconds

Post by Support Team »


agreed, and BTW this was not the first (and not the only) time OPC Foundation relied on / got inspired by some Microsoft related technical detail, but finally found that it was not the smartest idea.
Best regards
Unified Automation Support Team

Post Reply