mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-15 11:36:16 +00:00
date: disable setting time on redox
This commit is contained in:
parent
318366c900
commit
7d07ffc47d
1 changed files with 11 additions and 3 deletions
|
@ -15,7 +15,7 @@ use chrono::{DateTime, FixedOffset, Local, Offset, Utc};
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use chrono::{Datelike, Timelike};
|
use chrono::{Datelike, Timelike};
|
||||||
use clap::{crate_version, App, Arg};
|
use clap::{crate_version, App, Arg};
|
||||||
#[cfg(all(unix, not(target_os = "macos")))]
|
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||||
use libc::{clock_settime, timespec, CLOCK_REALTIME};
|
use libc::{clock_settime, timespec, CLOCK_REALTIME};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
|
@ -67,10 +67,12 @@ static RFC_3339_HELP_STRING: &str = "output date/time in RFC 3339 format.
|
||||||
for date and time to the indicated precision.
|
for date and time to the indicated precision.
|
||||||
Example: 2006-08-14 02:34:56-06:00";
|
Example: 2006-08-14 02:34:56-06:00";
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(any(target_os = "macos", target_os = "redox")))]
|
||||||
static OPT_SET_HELP_STRING: &str = "set time described by STRING";
|
static OPT_SET_HELP_STRING: &str = "set time described by STRING";
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on mac yet)";
|
static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on mac yet)";
|
||||||
|
#[cfg(target_os = "redox")]
|
||||||
|
static OPT_SET_HELP_STRING: &str = "set time described by STRING (not available on redox yet)";
|
||||||
|
|
||||||
/// Settings for this program, parsed from the command line
|
/// Settings for this program, parsed from the command line
|
||||||
struct Settings {
|
struct Settings {
|
||||||
|
@ -357,7 +359,13 @@ fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, not(target_os = "macos")))]
|
#[cfg(target_os = "redox")]
|
||||||
|
fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
||||||
|
eprintln!("date: setting the date is not supported by Redox");
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||||
/// System call to set date (unix).
|
/// System call to set date (unix).
|
||||||
/// See here for more:
|
/// See here for more:
|
||||||
/// https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html
|
/// https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/fn.clock_settime.html
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue