mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: The 'NIOFileSystem' target isn't yet stable API and is made available via the '_NIOFileSystemModule' product. This doesn't make it obvious enough that the module isn't yet considered stable. Modifications: - Rename 'NIOFileSystem' and 'NIOFileSystemFoundationCompat' such that they are prefixed with '_'. Result: More obviously not stable API
34 lines
1004 B
Swift
34 lines
1004 B
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2023 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android)
|
|
import _NIOFileSystem
|
|
|
|
import struct Foundation.Date
|
|
|
|
extension Date {
|
|
public init(timespec: FileInfo.Timespec) {
|
|
let timeInterval = Double(timespec.seconds) + Double(timespec.nanoseconds) / 1_000_000_000
|
|
self = Date(timeIntervalSince1970: timeInterval)
|
|
}
|
|
}
|
|
|
|
extension FileInfo.Timespec {
|
|
/// The UTC time of the timestamp.
|
|
public var date: Date {
|
|
return Date(timespec: self)
|
|
}
|
|
}
|
|
#endif
|