9 Commits

Author SHA1 Message Date
Tony Parker
ffaabbd571
Add Strideable conformance to Date (#411) 2024-02-12 08:58:27 -08:00
Charles Hu
7272a47c0b
Refactoring some import conditions (#298) 2023-10-25 15:11:37 -07:00
Tony Parker
d942713680
Sink TimeZone, Locale, Calendar to Essentials (#266)
* Sink Locale, Calendar to Essentials

* Add a Calendar test, make sure that _lock is populated early for NSSwiftCalendar
2023-09-25 16:09:16 -07:00
Saleem Abdulrasool
9e0f1fd312
Date: protect against invalid use of _gmtime_s (#170)
In the case that `_gmtime_s` fails, the return value is initialised to
an invalid value that will fail when invoking `_strftime`.
2023-06-07 09:01:47 -07:00
Saleem Abdulrasool
f9d9cd7ca2
FoundationEssentials: implement getCurrentAbsoluteTime on Windows (#163)
Implement querying the current absolute time on Windows which was
previously marked as unimplemented.  Use the
`GetSystemTimePreciseAsFileTime` to query the system time which is in
100-ns intervals since January 1, 1601 (UTC).  This partially enables
the `Date` functionality on Windows.
2023-06-06 20:49:53 -07:00
Saleem Abdulrasool
459b49acf6
FoundationEssentials: port Date to Windows
MSVCRT does not provide `gmtime_r`.  `gmtime` is re-entrant safe, but
uses TLS storage.  Prefer to use `_gmtime64_s` which provides the
re-entrancy with local buffers but swaps parameter orders.  Prefer to
use the 64-bit time variant over the 32-bit `time_t`.
2023-05-17 09:52:14 -07:00
Daniel Höpfl
97e92fd563
Fixes issue #78: Calling Date.description might result in undefined behaviour (#93)
* Fixes issue #78: Calling Date.description might result in undefined behaviour

The buffer used was too small in some cases.
Fixed by allocating (more than) enough space on the stack.

* Fixed indentation.

* Removed explicit return type.

* Added tests and added workarounds for glibc non-standard behaviour.

Also limited description to show dates in the range .distantPast to
.distandFuture since values way outside that range sometimes result in
incorrect results.
2023-05-09 11:16:38 -07:00
Charles Hu
e2e38a0bc0 rdar://106051615 (Move Calendar, Locale, and TimeZone to FoundationPreview) 2023-03-03 18:32:33 -08:00
Charles Hu
222a74b687 rdar://105685857 (Move Date to FoundationEssentials) 2023-02-28 14:11:23 -08:00