Josh Megnauth
090391d94f
fix(strptime): Don't clobber struct tm
...
Our strptime implementation uses subformatting to handle specifiers that
expand to other specifiers. For example, '%T' expands to "%H:%M%:%S".
Relibc calls strptime again to handle '%T' by expanding it.
However, our strptime zeroes out struct tm which clobbers old values. If
strptime is called with a format string like "%D%t%T", the set values
for '%D' are clobbered.
Zeroing out the struct is extra, unneeded work as well. The user may
want to preserve old values. We don't read from struct tm so we don't
have to worry about invalid values. Finally, `musl` and `glibc` don't
clear the values either so we can default to their behavior.
2025-04-01 23:35:29 -04:00
Darley Barreto
26573d02d1
Time improvements
2025-03-29 19:29:20 +00:00
Josh Megnauth
ccc1b7f560
strftime: ISO-8601 leap weeks
2025-03-20 02:34:26 -04:00
Josh Megnauth
8e6bcb6653
strptime: Implement %T, minor cleanups
...
* %T is implemented but untested for now (we lack strptime tests)
* I switched some unexported, immutable statics to const as it's a
better fit
* parse_am_pm() now correctly strips prefixed whitespace AND doesn't
allocate heap memory
2025-03-18 00:45:50 -04:00
Darley Barreto
dda7142385
Few improvements to time.h
2025-02-26 23:58:57 +00:00
Peter Limkilde Svendsen
a98fe90498
Fix clock_getcpuclockid() parameter type
2025-02-03 21:50:51 +01:00
Peter Limkilde Svendsen
0f0bc8fc5e
Formatting
2025-02-02 22:42:05 +01:00
Peter Limkilde Svendsen
3f88c9042d
Add missing function stubs
2025-02-02 22:41:45 +01:00
Peter Limkilde Svendsen
b0c6991f57
Reorder alphabetically
2025-02-02 22:28:32 +01:00
Peter Limkilde Svendsen
ef6b64a7c2
Doc and pub use for strptime
2025-02-02 22:22:39 +01:00
Peter Limkilde Svendsen
ee4f346ef0
Add docs and deprecations for time.h
2025-02-02 22:19:57 +01:00
Guillaume Gielly
b5b5bd2522
Support building with #![deny(unsafe_op_in_unsafe_fn)]
2025-01-05 23:02:04 +01:00
Guillaume Gielly
cf106906b5
Code cleanup
2025-01-05 22:30:35 +01:00
Guillaume Gielly
ffd5edd283
Add strptime() module and clean up unused strptime function
2025-01-05 20:10:50 +01:00
Guillaume Gielly
ba225e2000
Refactor strftime() to use langinfo constants for locale-based formatting :
...
- replaced hardcoded day and month names with calls to nl_langinfo,
- integrated langinfo constants DAY_1, ABDAY_1, MON_1, ABMON_1) for weekday and month names,
- used AM_STR and PM_STR for AM/PM strings in %p and %P specifiers,
- add comments.
2025-01-05 19:45:29 +01:00
Darley Barreto
c14b2cee4c
Adding tzset, timezone awareness, and some tweaks
2025-01-02 20:19:34 +00:00
Josh Megnauth
5348273ccc
Emit C attributes via cbindgen
2024-11-17 16:15:07 +00:00
4lDO2
313b32c815
Switch almost all of Pal to Rusty error handling.
2024-09-27 10:19:44 +02:00
4lDO2
6e5959b3fa
Convert a bunch of c_int to Result<(), Errno>.
2024-09-26 16:21:34 +02:00
4lDO2
c0e7af5289
Backwards-compatibly rewrite getdents to use special syscall.
2024-09-11 23:32:19 +02:00
Peter Limkilde Svendsen
17076f37b9
Refactor mktime, timegm and fix wcpncpy test
2024-08-01 18:42:01 +00:00
Peter Limkilde Svendsen
a7137512fa
Use standard casing and mangling for internal errno
2024-03-01 00:25:42 +00:00
Peter Limkilde Svendsen
9093f6bc47
Use Cell representation for errno
2024-02-29 14:07:40 +00:00
4lDO2
cdd0f67b23
Rustfmt.
2023-05-17 15:28:10 +02:00
Jeremy Soller
64849c7d59
Fix types for 32-bit systems
2023-05-11 11:44:24 -06:00
Jeremy Soller
848fde933b
Merge branch 'remove_pthreads_emb' into 'master'
...
Replace pthreads-emb with a native implementation
See merge request redox-os/relibc!380
2023-05-11 13:56:11 +00:00
David Carlier
2db85f9a3f
clock_getres/clock_settime additions
2023-05-08 18:52:05 +01:00
Ron Williams
95e9162d22
change tzname to be mut
2023-05-06 13:20:30 -07:00
4lDO2
cf34e2512e
Move condvar impl to a mostly-safe module.
2023-05-06 17:02:51 +02:00
Ron Williams
c3f3da6958
fix tzset cbindgen declarations
2023-05-06 02:55:36 -07:00
Ron Williams
efeca2f909
Add no-op tzset, plus required static vars
2023-05-04 13:12:04 -07:00
Jeremy Soller
6516695519
Format
2022-12-16 17:39:30 -07:00
Jeremy Soller
59b2e32953
Fix compilation on 32-bit systems
2022-12-02 08:00:36 -07:00
Jeremy Soller
9e0c53f222
Make long 32-bits on 32-bit systems
2022-12-01 18:33:00 -07:00
Jeremy Soller
16abc91341
cargo fmt and cargo fix
2022-11-11 13:27:18 -07:00
Jeremy Soller
075fd5be62
Merge branch 'gmtime-yday-fix' into 'master'
...
Simplify gmtime_r() day-of-year calculation, correct comment
See merge request redox-os/relibc!311
2021-03-27 16:53:08 +00:00
Peter Limkilde Svendsen
f49be31762
Use as-less cast
2021-02-19 00:17:24 +01:00
Peter Limkilde Svendsen
aef1be7c1b
Remove errno setting
2020-09-17 23:10:13 +02:00
Peter Limkilde Svendsen
8ef64676fe
Use stricter/simpler type handling
2020-09-17 23:10:13 +02:00
Peter Limkilde Svendsen
18a12c6c3d
Add range assertions to asctime_r()
2020-09-17 23:10:13 +02:00
Peter Limkilde Svendsen
071475783a
Simplify day-of-year calculation, correct comment
2020-09-10 23:34:56 +02:00
Jeremy Soller
2ed55a926b
Merge branch 'gmtime-refactor' into 'master'
...
Refactor gmtime_r(), fix localtime() test
See merge request redox-os/relibc!309
2020-09-08 18:45:20 +00:00
Peter Limkilde Svendsen
63711f6ca7
Formatting
2020-08-27 23:16:17 +02:00
Peter Limkilde Svendsen
845c74a82e
Refactor gmtime_r()
2020-08-27 23:16:17 +02:00
Peter Limkilde Svendsen
86138c9f8a
Align parameter naming with POSIX
2020-08-27 23:16:17 +02:00
Peter Limkilde Svendsen
23b2eb2573
Avoid assuming c_char is i8
2020-08-23 21:45:08 +02:00
jD91mZM2
593925ceb4
Unambiguate all include guards
...
GNU binutils also uses _FNMATCH_H for a guard, maybe along others!
2020-06-29 11:34:51 +02:00
Peter Limkilde Svendsen
ac52c3f205
Replace mem::uninitialized()
2020-05-26 17:58:59 +02:00
Jeremy Soller
2e27cf525e
Work on adding cargo test capability
2020-03-10 20:57:07 -06:00
AdminXVII
884ec85838
Replace occurences of uninitialized with MaybeUninit
...
mem::uninitialized is deprecated, so move over the not-UB MaybeUninit.
2020-01-20 16:54:22 +00:00