However, the microsecond value specified in this structure does not change when I use the function, I can only read values up to milliseconds. What could be the reason? Also, is it possible to get it in nanoseconds?
Hi,
the microseconds element is included only for some compatibility reasons in the DTstructure, but isn’t used.
The’re possibilities to get microsecond information from the runtime, for example AsIOGetTimestamp() function, normally used for timespan topics (like doing some measurement or so), not for absolute time or date and time (of course you could combine such information If needed).
Nanosecond information isn’t provided in both cases, as I know.
The help does state that the DTStructure and TimeStructure include the microseconds for compatibility. If you are using a DT, DATE_AND_TIME variable to initialize your structure, you won’t get any values for microseconds. The DATE_AND_TIME and DATE data types used as the bases for these structures are defined by the IEC 61131-3 standard, which are measuring seconds since UNIX epoch (i.e. Jan 1, 1970 00:00).
NTP is only meant to calibrate machines to within a few milliseconds anyways; as Stratum 1 machines, i.e. devices connected to the atomic clocks, will be microseconds off the device anyways.
Nanosecond information was requested by one of our customers and I could not understand exactly why. After explaining that our controller works with 2500 Hz and therefore we could not provide such sensitive information even if we wanted to, they gave up their request. Thank you for your help anyway.