File tree 2 files changed +7
-1
lines changed
Sources/FoundationEssentials
Tests/FoundationEssentialsTests
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ extension Date {
229
229
li. LowPart = ft. dwLowDateTime
230
230
li. HighPart = ft. dwHighDateTime
231
231
// FILETIME represents 100-ns intervals since January 1, 1601 (UTC)
232
- return TimeInterval ( ( li. QuadPart - 1164447360_000_000 ) / 1_000_000_000 )
232
+ return TimeInterval ( Double ( li. QuadPart) / 10_000_000.0 - Self . timeIntervalBetween1601AndReferenceDate )
233
233
#else
234
234
var ts : timespec = timespec ( )
235
235
clock_gettime ( CLOCK_REALTIME, & ts)
Original file line number Diff line number Diff line change @@ -127,6 +127,12 @@ final class DateTests : XCTestCase {
127
127
XCTAssertEqual ( " <description unavailable> " , date. description)
128
128
#endif
129
129
}
130
+
131
+ func testNowIsAfterReasonableDate( ) {
132
+ let date = Date . now
133
+ XCTAssert ( date. timeIntervalSinceReferenceDate > 742100000.0 ) // "2024-07-08T02:53:20Z"
134
+ XCTAssert ( date. timeIntervalSinceReferenceDate < 3896300000.0 ) // "2124-06-21T01:33:20Z"
135
+ }
130
136
}
131
137
132
138
// MARK: - Bridging
You can’t perform that action at this time.
0 commit comments