Merge branch 'master' into 'master'

fix(ci): make it green

See merge request redox-os/relibc!786
This commit is contained in:
Jeremy Soller
2025-12-08 16:50:39 -07:00
3 changed files with 19 additions and 4 deletions
+4 -4
View File
@@ -1,7 +1,5 @@
use crate::platform::types::*;
pub use self::sys::*;
#[cfg(target_os = "linux")]
#[path = "linux.rs"]
pub mod sys;
@@ -10,6 +8,8 @@ pub mod sys;
#[path = "redox.rs"]
pub mod sys;
pub use self::sys::*;
pub(crate) const UTC: *const c_char = b"UTC\0".as_ptr().cast();
pub(crate) const DAY_NAMES: [&str; 7] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
@@ -28,6 +28,6 @@ pub const TIMER_ABSTIME: c_int = 1;
// The values are offset by one for simplicity since zero represents an error.
/// `TIME_UTC` returns the time since the Unix epoch.
pub const TIME_UTC: c_int = sys::CLOCK_REALTIME + 1;
pub const TIME_UTC: c_int = CLOCK_REALTIME + 1;
/// `TIME_MONOTONIC` returns the time from the monotonically increasing clock.
pub const TIME_MONOTONIC: c_int = sys::CLOCK_MONOTONIC + 1;
pub const TIME_MONOTONIC: c_int = CLOCK_MONOTONIC + 1;
+12
View File
@@ -7,6 +7,9 @@ void test_localtime_r_epoch() {
time_t t = 0; // Unix epoch (1970-01-01 00:00:00)
struct tm result;
setenv("TZ", "UTC", 1);
tzset();
assert(localtime_r(&t, &result) != NULL);
assert(result.tm_year == 70); // Year 1970 - 1900
assert(result.tm_mon == 0); // January
@@ -22,6 +25,9 @@ void test_localtime_r_non_epoch() {
time_t t = 1609459200; // January 1, 2021 00:00:00 UTC (New Year 2021)
struct tm result;
setenv("TZ", "UTC", 1);
tzset();
assert(localtime_r(&t, &result) != NULL);
assert(result.tm_year == 121); // Year 2021 - 1900
assert(result.tm_mon == 0); // January
@@ -35,6 +41,9 @@ void test_localtime_r_dst() {
time_t t = 1615708800; // March 14 2021 08:00:00 UTC
struct tm result;
setenv("TZ", "UTC", 1);
tzset();
assert(localtime_r(&t, &result) != NULL); // Ensure localtime_r does not fail
assert(result.tm_year == 121); // Year 2021 - 1900
assert(result.tm_mon == 2); // March
@@ -48,6 +57,9 @@ void test_localtime_r_large_time() {
time_t t = 32503680000; // A large value: 1 January 3000 (UTC)
struct tm result;
setenv("TZ", "UTC", 1);
tzset();
assert(localtime_r(&t, &result) != NULL); // Ensure localtime_r does not fail
assert(result.tm_year == 1100); // Year 3000 - 1900 = 1100
assert(result.tm_mon == 0); // January
+3
View File
@@ -4,6 +4,9 @@
#include <assert.h>
int main(void) {
setenv("TZ", "UTC", 1);
tzset();
struct {
time_t timestamp;
const char *expected_asctime;