TrueTime.swift icon indicating copy to clipboard operation
TrueTime.swift copied to clipboard

TrueTimeClient.sharedInstance.referenceTime?.now() returns date with millisecond precision

Open Visput opened this issue 8 years ago • 1 comments

I noticed that TrueTimeClient.sharedInstance.referenceTime?.now() returns date with millisecond precision while system call Date() returns date with microsecond precision.

This behavior can be verified in following way:

print(TrueTimeClient.sharedInstance.referenceTime!.now().timeIntervalSince1970) // Prints 1492622263.091

print(Date().timeIntervalSince1970) // Prints 1492622263.12779

Such loose in precision can be harmful for tasks which depend on timestamp accuracy.

Visput avatar Apr 19 '17 17:04 Visput

@Visput: Good point. NTP doesn't support this level of precision but we can update the data types used internally to at least maintain what is returned by the initial system calls.

msanders avatar Jul 15 '17 23:07 msanders