tests/dmesg: use fixed offset time argument in test.

This commit is contained in:
Fuad Ismail 2024-12-12 12:54:58 +07:00
parent 48c4f78088
commit b90751119d
2 changed files with 2 additions and 12 deletions
src/uu/dmesg/src
tests/by-util

@ -118,8 +118,6 @@ impl DeltaFormatter {
}
pub fn parse_datetime(s: &str) -> UResult<DateTime<FixedOffset>> {
#[cfg(feature = "fixed-boot-time")]
set_fixed_timezone();
match parse_datetime::parse_datetime(s) {
Ok(date_time) => Ok(date_time),
Err(_) => Err(USimpleError::new(1, format!("invalid time value \"{s}\""))),
@ -184,11 +182,3 @@ fn boot_time_from_utmpx() -> Option<DateTime<FixedOffset>> {
}
None
}
#[cfg(feature = "fixed-boot-time")]
static SET_TZ: OnceLock<()> = OnceLock::new();
#[cfg(feature = "fixed-boot-time")]
fn set_fixed_timezone() {
*SET_TZ.get_or_init(|| std::env::set_var("TZ", "Asia/Jakarta"))
}

@ -152,8 +152,8 @@ fn test_since_until() {
new_ucmd!()
.arg("--kmsg-file")
.arg("kmsg.input")
.arg("--since=\"2024-11-19 17:47:32\"")
.arg("--until=\"2024-11-19 18:55:52\"")
.arg("--since=\"2024-11-19 17:47:32 +0700\"")
.arg("--until=\"2024-11-19 18:55:52 +0700\"")
.succeeds()
.stdout_only_fixture("test_since_until.expected");
}