How can the DAAppearance Time from the DiskArbitration be converted to a valid Timestamp?
I tried the following:
if let appearanceTime = diskinfo["DAAppearanceTime"] as? NSNumber{
print(appearanceTime)
let date = NSDate(timeIntervalSince1970: TimeInterval(appearanceTime))
print(date)
}
I get the correct DAAppearanceTime back from the function but the wrong Year after the conversion:
511348742.912949
1986-03-16 09:19:02 +0000
The
"DAAppearanceTime"key is not officially documented, but the DiskArbitration framework is open source.DAInternal.c:
DADisk.c:
So the value of that key is what
CFAbsoluteTimeGetCurrent()returns, and that is theYou convert it to a
Datelike this:For the value
511348742.912949this results in the date2017-03-16 09:19:02 +0000.