Skip to content
This repository was archived by the owner on Dec 15, 2024. It is now read-only.

Commit 649cfde

Browse files
committed
Fixed WASM support
1 parent 6d550ad commit 649cfde

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Sources/SwiftFoundation/POSIXTime.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ internal extension timespec {
7575

7676
let nanoseconds = decimalValue * billion
7777

78-
self.init(tv_sec: Int(integerValue), tv_nsec: Int(nanoseconds))
78+
self.init(tv_sec: .init(integerValue), tv_nsec: .init(nanoseconds))
7979
}
8080

8181
var timeInterval: SwiftFoundation.TimeInterval {
@@ -108,14 +108,16 @@ internal extension tm {
108108
// MARK: - Cross-Platform Support
109109

110110
#if canImport(Darwin)
111-
112111
internal typealias POSIXMicroseconds = __darwin_suseconds_t
113-
114112
#else
113+
114+
#if arch(wasm32)
115+
internal typealias POSIXMicroseconds = Int32
116+
#else
117+
internal typealias POSIXMicroseconds = __suseconds_t
118+
#endif
115119

116-
public typealias POSIXMicroseconds = __suseconds_t
117-
118-
public func modf(value: Double) -> (Double, Double) {
120+
internal func modf(value: Double) -> (Double, Double) {
119121

120122
var integerValue: Double = 0
121123

Sources/SwiftFoundation/Thread.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import Darwin
1212
import Glibc
1313
#endif
1414

15+
#if !arch(wasm32)
16+
1517
/// POSIX Thread
1618
public final class Thread {
1719

@@ -120,3 +122,5 @@ fileprivate extension Thread {
120122
}
121123
}
122124
}
125+
126+
#endif

0 commit comments

Comments
 (0)