Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Sources/Foundation/FileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,14 @@ open class FileManager : NSObject {
result[.creationDate] = creationDate
#else
let s = try _lstatFile(atPath: path)
// Darwin provides a `st_ctimespec` rather than the traditional Unix
// `st_ctime` field. Since `st_ctime` is more traditional, special case
// Darwin platforms and convert the timespec to the absolute time.
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
result[.creationDate] = Date(timespec: s.st_ctimespec)
#else
result[.creationDate] = Date(timeIntervalSince1970: TimeInterval(s.st_ctime))
#endif
#endif

result[.size] = NSNumber(value: UInt64(s.st_size))
Expand Down