mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #8258 from sylvestre/l10n-date
l10n: port date for translation + add french
This commit is contained in:
commit
04b0a859e3
3 changed files with 186 additions and 44 deletions
|
@ -74,3 +74,31 @@ date-usage =
|
||||||
Show the time on the west coast of the US (use tzselect(1) to find TZ)
|
Show the time on the west coast of the US (use tzselect(1) to find TZ)
|
||||||
|
|
||||||
TZ='America/Los_Angeles' date
|
TZ='America/Los_Angeles' date
|
||||||
|
|
||||||
|
date-help-date = display time described by STRING, not 'now'
|
||||||
|
date-help-file = like --date; once for each line of DATEFILE
|
||||||
|
date-help-iso-8601 = output date/time in ISO 8601 format.
|
||||||
|
FMT='date' for date only (the default),
|
||||||
|
'hours', 'minutes', 'seconds', or 'ns'
|
||||||
|
for date and time to the indicated precision.
|
||||||
|
Example: 2006-08-14T02:34:56-06:00
|
||||||
|
date-help-rfc-email = output date and time in RFC 5322 format.
|
||||||
|
Example: Mon, 14 Aug 2006 02:34:56 -0600
|
||||||
|
date-help-rfc-3339 = output date/time in RFC 3339 format.
|
||||||
|
FMT='date', 'seconds', or 'ns'
|
||||||
|
for date and time to the indicated precision.
|
||||||
|
Example: 2006-08-14 02:34:56-06:00
|
||||||
|
date-help-debug = annotate the parsed date, and warn about questionable usage to stderr
|
||||||
|
date-help-reference = display the last modification time of FILE
|
||||||
|
date-help-set = set time described by STRING
|
||||||
|
date-help-set-macos = set time described by STRING (not available on mac yet)
|
||||||
|
date-help-set-redox = set time described by STRING (not available on redox yet)
|
||||||
|
date-help-universal = print or set Coordinated Universal Time (UTC)
|
||||||
|
|
||||||
|
date-error-invalid-date = invalid date '{$date}'
|
||||||
|
date-error-invalid-format = invalid format '{$format}' ({$error})
|
||||||
|
date-error-expected-file-got-directory = expected file, got directory '{$path}'
|
||||||
|
date-error-date-overflow = date overflow '{$date}'
|
||||||
|
date-error-setting-date-not-supported-macos = setting the date is not supported by macOS
|
||||||
|
date-error-setting-date-not-supported-redox = setting the date is not supported by Redox
|
||||||
|
date-error-cannot-set-date = cannot set date
|
||||||
|
|
101
src/uu/date/locales/fr-FR.ftl
Normal file
101
src/uu/date/locales/fr-FR.ftl
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
date-about = afficher ou définir la date système
|
||||||
|
date-usage = [OPTION]... [+FORMAT]
|
||||||
|
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
|
||||||
|
|
||||||
|
FORMAT contrôle la sortie. Les séquences interprétées sont :
|
||||||
|
{ "| Séquence | Description | Exemple |" }
|
||||||
|
{ "| -------- | -------------------------------------------------------------- | ---------------------- |" }
|
||||||
|
{ "| %% | un % littéral | % |" }
|
||||||
|
{ "| %a | nom abrégé du jour de la semaine selon la locale | dim |" }
|
||||||
|
{ "| %A | nom complet du jour de la semaine selon la locale | dimanche |" }
|
||||||
|
{ "| %b | nom abrégé du mois selon la locale | jan |" }
|
||||||
|
{ "| %B | nom complet du mois selon la locale | janvier |" }
|
||||||
|
{ "| %c | date et heure selon la locale | jeu 3 mar 23:05:25 2005|" }
|
||||||
|
{ "| %C | siècle ; comme %Y, sauf qu'on omet les deux derniers chiffres | 20 |" }
|
||||||
|
{ "| %d | jour du mois | 01 |" }
|
||||||
|
{ "| %D | date ; identique à %m/%d/%y | 12/31/99 |" }
|
||||||
|
{ "| %e | jour du mois, rempli avec des espaces ; identique à %_d | 3 |" }
|
||||||
|
{ "| %F | date complète ; identique à %Y-%m-%d | 2005-03-03 |" }
|
||||||
|
{ "| %g | deux derniers chiffres de l'année du numéro de semaine ISO (voir %G) | 05 |" }
|
||||||
|
{ "| %G | année du numéro de semaine ISO (voir %V) ; normalement utile seulement avec %V | 2005 |" }
|
||||||
|
{ "| %h | identique à %b | jan |" }
|
||||||
|
{ "| %H | heure (00..23) | 23 |" }
|
||||||
|
{ "| %I | heure (01..12) | 11 |" }
|
||||||
|
{ "| %j | jour de l'année (001..366) | 062 |" }
|
||||||
|
{ "| %k | heure, remplie avec des espaces ( 0..23) ; identique à %_H | 3 |" }
|
||||||
|
{ "| %l | heure, remplie avec des espaces ( 1..12) ; identique à %_I | 9 |" }
|
||||||
|
{ "| %m | mois (01..12) | 03 |" }
|
||||||
|
{ "| %M | minute (00..59) | 30 |" }
|
||||||
|
{ "| %n | une nouvelle ligne | \\n |" }
|
||||||
|
{ "| %N | nanosecondes (000000000..999999999) | 123456789 |" }
|
||||||
|
{ "| %p | équivalent locale de AM ou PM ; vide si inconnu | PM |" }
|
||||||
|
{ "| %P | comme %p, mais en minuscules | pm |" }
|
||||||
|
{ "| %q | trimestre de l'année (1..4) | 1 |" }
|
||||||
|
{ "| %r | heure sur 12 heures selon la locale | 11:11:04 PM |" }
|
||||||
|
{ "| %R | heure sur 24 heures et minute ; identique à %H:%M | 23:30 |" }
|
||||||
|
{ "| %s | secondes depuis 1970-01-01 00:00:00 UTC | 1615432800 |" }
|
||||||
|
{ "| %S | seconde (00..60) | 30 |" }
|
||||||
|
{ "| %t | une tabulation | \\t |" }
|
||||||
|
{ "| %T | heure ; identique à %H:%M:%S | 23:30:30 |" }
|
||||||
|
{ "| %u | jour de la semaine (1..7) ; 1 est lundi | 4 |" }
|
||||||
|
{ "| %U | numéro de semaine de l'année, avec dimanche comme premier jour de la semaine (00..53) | 10 |" }
|
||||||
|
{ "| %V | numéro de semaine ISO, avec lundi comme premier jour de la semaine (01..53) | 12 |" }
|
||||||
|
{ "| %w | jour de la semaine (0..6) ; 0 est dimanche | 4 |" }
|
||||||
|
{ "| %W | numéro de semaine de l'année, avec lundi comme premier jour de la semaine (00..53) | 11 |" }
|
||||||
|
{ "| %x | représentation de la date selon la locale | 03/03/2005 |" }
|
||||||
|
{ "| %X | représentation de l'heure selon la locale | 23:30:30 |" }
|
||||||
|
{ "| %y | deux derniers chiffres de l'année (00..99) | 05 |" }
|
||||||
|
{ "| %Y | année | 2005 |" }
|
||||||
|
{ "| %z | fuseau horaire numérique +hhmm | -0400 |" }
|
||||||
|
{ "| %:z | fuseau horaire numérique +hh:mm | -04:00 |" }
|
||||||
|
{ "| %::z | fuseau horaire numérique +hh:mm:ss | -04:00:00 |" }
|
||||||
|
{ "| %:::z | fuseau horaire numérique avec : à la précision nécessaire | -04, +05:30 |" }
|
||||||
|
{ "| %Z | abréviation alphabétique du fuseau horaire | EDT |" }
|
||||||
|
|
||||||
|
Par défaut, date remplit les champs numériques avec des zéros.
|
||||||
|
Les indicateurs optionnels suivants peuvent suivre '%' :
|
||||||
|
{ "* `-` (tiret) ne pas remplir le champ" }
|
||||||
|
{ "* `_` (soulignement) remplir avec des espaces" }
|
||||||
|
{ "* `0` (zéro) remplir avec des zéros" }
|
||||||
|
{ "* `^` utiliser des majuscules si possible" }
|
||||||
|
{ "* `#` utiliser l'inverse si possible" }
|
||||||
|
Après tout indicateur vient une largeur de champ optionnelle, comme nombre décimal ;
|
||||||
|
puis un modificateur optionnel, qui est soit
|
||||||
|
{ "* `E` pour utiliser les représentations alternatives de la locale si disponibles, ou" }
|
||||||
|
{ "* `O` pour utiliser les symboles numériques alternatifs de la locale si disponibles." }
|
||||||
|
Exemples :
|
||||||
|
Convertir les secondes depuis l'époque (1970-01-01 UTC) en date
|
||||||
|
|
||||||
|
date --date='@2147483647'
|
||||||
|
|
||||||
|
Montrer l'heure sur la côte ouest des États-Unis (utiliser tzselect(1) pour trouver TZ)
|
||||||
|
|
||||||
|
TZ='America/Los_Angeles' date
|
||||||
|
|
||||||
|
date-help-date = afficher l'heure décrite par CHAÎNE, pas 'maintenant'
|
||||||
|
date-help-file = comme --date ; une fois pour chaque ligne de FICHIER_DATE
|
||||||
|
date-help-iso-8601 = afficher la date/heure au format ISO 8601.
|
||||||
|
FMT='date' pour la date seulement (par défaut),
|
||||||
|
'hours', 'minutes', 'seconds', ou 'ns'
|
||||||
|
pour la date et l'heure à la précision indiquée.
|
||||||
|
Exemple : 2006-08-14T02:34:56-06:00
|
||||||
|
date-help-rfc-email = afficher la date et l'heure au format RFC 5322.
|
||||||
|
Exemple : Mon, 14 Aug 2006 02:34:56 -0600
|
||||||
|
date-help-rfc-3339 = afficher la date/heure au format RFC 3339.
|
||||||
|
FMT='date', 'seconds', ou 'ns'
|
||||||
|
pour la date et l'heure à la précision indiquée.
|
||||||
|
Exemple : 2006-08-14 02:34:56-06:00
|
||||||
|
date-help-debug = annoter la date analysée et avertir des usages douteux sur stderr
|
||||||
|
date-help-reference = afficher l'heure de dernière modification du FICHIER
|
||||||
|
date-help-set = définir l'heure décrite par CHAÎNE
|
||||||
|
date-help-set-macos = définir l'heure décrite par CHAÎNE (pas encore disponible sur mac)
|
||||||
|
date-help-set-redox = définir l'heure décrite par CHAÎNE (pas encore disponible sur redox)
|
||||||
|
date-help-universal = afficher ou définir le Temps Universel Coordonné (UTC)
|
||||||
|
|
||||||
|
date-error-invalid-date = date invalide '{$date}'
|
||||||
|
date-error-invalid-format = format invalide '{$format}' ({$error})
|
||||||
|
date-error-expected-file-got-directory = fichier attendu, répertoire obtenu '{$path}'
|
||||||
|
date-error-date-overflow = débordement de date '{$date}'
|
||||||
|
date-error-setting-date-not-supported-macos = la définition de la date n'est pas prise en charge par macOS
|
||||||
|
date-error-setting-date-not-supported-redox = la définition de la date n'est pas prise en charge par Redox
|
||||||
|
date-error-cannot-set-date = impossible de définir la date
|
|
@ -14,14 +14,14 @@ use libc::{CLOCK_REALTIME, clock_settime, timespec};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use uucore::display::Quotable;
|
|
||||||
use uucore::error::FromIo;
|
use uucore::error::FromIo;
|
||||||
use uucore::error::{UResult, USimpleError};
|
use uucore::error::{UResult, USimpleError};
|
||||||
use uucore::{format_usage, show};
|
use uucore::{format_usage, show};
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use windows_sys::Win32::{Foundation::SYSTEMTIME, System::SystemInformation::SetSystemTime};
|
use windows_sys::Win32::{Foundation::SYSTEMTIME, System::SystemInformation::SetSystemTime};
|
||||||
|
|
||||||
use uucore::locale::get_message;
|
use std::collections::HashMap;
|
||||||
|
use uucore::locale::{get_message, get_message_with_args};
|
||||||
use uucore::parser::shortcut_value_parser::ShortcutValueParser;
|
use uucore::parser::shortcut_value_parser::ShortcutValueParser;
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
|
@ -43,29 +43,6 @@ const OPT_REFERENCE: &str = "reference";
|
||||||
const OPT_UNIVERSAL: &str = "universal";
|
const OPT_UNIVERSAL: &str = "universal";
|
||||||
const OPT_UNIVERSAL_2: &str = "utc";
|
const OPT_UNIVERSAL_2: &str = "utc";
|
||||||
|
|
||||||
// Help strings
|
|
||||||
|
|
||||||
static ISO_8601_HELP_STRING: &str = "output date/time in ISO 8601 format.
|
|
||||||
FMT='date' for date only (the default),
|
|
||||||
'hours', 'minutes', 'seconds', or 'ns'
|
|
||||||
for date and time to the indicated precision.
|
|
||||||
Example: 2006-08-14T02:34:56-06:00";
|
|
||||||
|
|
||||||
static RFC_5322_HELP_STRING: &str = "output date and time in RFC 5322 format.
|
|
||||||
Example: Mon, 14 Aug 2006 02:34:56 -0600";
|
|
||||||
|
|
||||||
static RFC_3339_HELP_STRING: &str = "output date/time in RFC 3339 format.
|
|
||||||
FMT='date', 'seconds', or 'ns'
|
|
||||||
for date and time to the indicated precision.
|
|
||||||
Example: 2006-08-14 02:34:56-06:00";
|
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "macos", target_os = "redox")))]
|
|
||||||
static OPT_SET_HELP_STRING: &str = "set time described by STRING";
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
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 {
|
||||||
utc: bool,
|
utc: bool,
|
||||||
|
@ -141,7 +118,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
if !form.starts_with('+') {
|
if !form.starts_with('+') {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
format!("invalid date {}", form.quote()),
|
get_message_with_args(
|
||||||
|
"date-error-invalid-date",
|
||||||
|
HashMap::from([("date".to_string(), form.to_string())]),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let form = form[1..].to_string();
|
let form = form[1..].to_string();
|
||||||
|
@ -182,7 +162,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
Some(Err((input, _err))) => {
|
Some(Err((input, _err))) => {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
format!("invalid date {}", input.quote()),
|
get_message_with_args(
|
||||||
|
"date-error-invalid-date",
|
||||||
|
HashMap::from([("date".to_string(), input.to_string())]),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
Some(Ok(date)) => Some(date),
|
Some(Ok(date)) => Some(date),
|
||||||
|
@ -231,7 +214,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
format!("invalid date {relative_time}"),
|
get_message_with_args(
|
||||||
|
"date-error-date-overflow",
|
||||||
|
HashMap::from([("date".to_string(), relative_time.to_string())]),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +231,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
2,
|
2,
|
||||||
format!("expected file, got directory {}", path.quote()),
|
get_message_with_args(
|
||||||
|
"date-error-expected-file-got-directory",
|
||||||
|
HashMap::from([("path".to_string(), path.to_string_lossy().to_string())]),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let file = File::open(path)
|
let file = File::open(path)
|
||||||
|
@ -271,13 +260,22 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(USimpleError::new(
|
return Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
format!("invalid format {format_string} ({e})"),
|
get_message_with_args(
|
||||||
|
"date-error-invalid-format",
|
||||||
|
HashMap::from([
|
||||||
|
("format".to_string(), format_string.to_string()),
|
||||||
|
("error".to_string(), e.to_string()),
|
||||||
|
]),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err((input, _err)) => show!(USimpleError::new(
|
Err((input, _err)) => show!(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
format!("invalid date {}", input.quote())
|
get_message_with_args(
|
||||||
|
"date-error-invalid-date",
|
||||||
|
HashMap::from([("date".to_string(), input.to_string())])
|
||||||
|
)
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +295,7 @@ pub fn uu_app() -> Command {
|
||||||
.long(OPT_DATE)
|
.long(OPT_DATE)
|
||||||
.value_name("STRING")
|
.value_name("STRING")
|
||||||
.allow_hyphen_values(true)
|
.allow_hyphen_values(true)
|
||||||
.help("display time described by STRING, not 'now'"),
|
.help(get_message("date-help-date")),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_FILE)
|
Arg::new(OPT_FILE)
|
||||||
|
@ -305,7 +303,7 @@ pub fn uu_app() -> Command {
|
||||||
.long(OPT_FILE)
|
.long(OPT_FILE)
|
||||||
.value_name("DATEFILE")
|
.value_name("DATEFILE")
|
||||||
.value_hint(clap::ValueHint::FilePath)
|
.value_hint(clap::ValueHint::FilePath)
|
||||||
.help("like --date; once for each line of DATEFILE"),
|
.help(get_message("date-help-file")),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_ISO_8601)
|
Arg::new(OPT_ISO_8601)
|
||||||
|
@ -317,13 +315,13 @@ pub fn uu_app() -> Command {
|
||||||
]))
|
]))
|
||||||
.num_args(0..=1)
|
.num_args(0..=1)
|
||||||
.default_missing_value(OPT_DATE)
|
.default_missing_value(OPT_DATE)
|
||||||
.help(ISO_8601_HELP_STRING),
|
.help(get_message("date-help-iso-8601")),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_RFC_EMAIL)
|
Arg::new(OPT_RFC_EMAIL)
|
||||||
.short('R')
|
.short('R')
|
||||||
.long(OPT_RFC_EMAIL)
|
.long(OPT_RFC_EMAIL)
|
||||||
.help(RFC_5322_HELP_STRING)
|
.help(get_message("date-help-rfc-email"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -331,12 +329,12 @@ pub fn uu_app() -> Command {
|
||||||
.long(OPT_RFC_3339)
|
.long(OPT_RFC_3339)
|
||||||
.value_name("FMT")
|
.value_name("FMT")
|
||||||
.value_parser(ShortcutValueParser::new([DATE, SECONDS, NS]))
|
.value_parser(ShortcutValueParser::new([DATE, SECONDS, NS]))
|
||||||
.help(RFC_3339_HELP_STRING),
|
.help(get_message("date-help-rfc-3339")),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_DEBUG)
|
Arg::new(OPT_DEBUG)
|
||||||
.long(OPT_DEBUG)
|
.long(OPT_DEBUG)
|
||||||
.help("annotate the parsed date, and warn about questionable usage to stderr")
|
.help(get_message("date-help-debug"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -345,21 +343,34 @@ pub fn uu_app() -> Command {
|
||||||
.long(OPT_REFERENCE)
|
.long(OPT_REFERENCE)
|
||||||
.value_name("FILE")
|
.value_name("FILE")
|
||||||
.value_hint(clap::ValueHint::AnyPath)
|
.value_hint(clap::ValueHint::AnyPath)
|
||||||
.help("display the last modification time of FILE"),
|
.help(get_message("date-help-reference")),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_SET)
|
Arg::new(OPT_SET)
|
||||||
.short('s')
|
.short('s')
|
||||||
.long(OPT_SET)
|
.long(OPT_SET)
|
||||||
.value_name("STRING")
|
.value_name("STRING")
|
||||||
.help(OPT_SET_HELP_STRING),
|
.help({
|
||||||
|
#[cfg(not(any(target_os = "macos", target_os = "redox")))]
|
||||||
|
{
|
||||||
|
get_message("date-help-set")
|
||||||
|
}
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
get_message("date-help-set-macos")
|
||||||
|
}
|
||||||
|
#[cfg(target_os = "redox")]
|
||||||
|
{
|
||||||
|
get_message("date-help-set-redox")
|
||||||
|
}
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(OPT_UNIVERSAL)
|
Arg::new(OPT_UNIVERSAL)
|
||||||
.short('u')
|
.short('u')
|
||||||
.long(OPT_UNIVERSAL)
|
.long(OPT_UNIVERSAL)
|
||||||
.alias(OPT_UNIVERSAL_2)
|
.alias(OPT_UNIVERSAL_2)
|
||||||
.help("print or set Coordinated Universal Time (UTC)")
|
.help(get_message("date-help-universal"))
|
||||||
.action(ArgAction::SetTrue),
|
.action(ArgAction::SetTrue),
|
||||||
)
|
)
|
||||||
.arg(Arg::new(OPT_FORMAT))
|
.arg(Arg::new(OPT_FORMAT))
|
||||||
|
@ -427,7 +438,7 @@ fn set_system_datetime(_date: Zoned) -> UResult<()> {
|
||||||
fn set_system_datetime(_date: Zoned) -> UResult<()> {
|
fn set_system_datetime(_date: Zoned) -> UResult<()> {
|
||||||
Err(USimpleError::new(
|
Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
"setting the date is not supported by macOS".to_string(),
|
get_message("date-error-setting-date-not-supported-macos"),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +446,7 @@ fn set_system_datetime(_date: Zoned) -> UResult<()> {
|
||||||
fn set_system_datetime(_date: Zoned) -> UResult<()> {
|
fn set_system_datetime(_date: Zoned) -> UResult<()> {
|
||||||
Err(USimpleError::new(
|
Err(USimpleError::new(
|
||||||
1,
|
1,
|
||||||
"setting the date is not supported by Redox".to_string(),
|
get_message("date-error-setting-date-not-supported-redox"),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +468,8 @@ fn set_system_datetime(date: Zoned) -> UResult<()> {
|
||||||
if result == 0 {
|
if result == 0 {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(std::io::Error::last_os_error().map_err_context(|| "cannot set date".to_string()))
|
Err(std::io::Error::last_os_error()
|
||||||
|
.map_err_context(|| get_message("date-error-cannot-set-date")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +495,8 @@ fn set_system_datetime(date: Zoned) -> UResult<()> {
|
||||||
let result = unsafe { SetSystemTime(&system_time) };
|
let result = unsafe { SetSystemTime(&system_time) };
|
||||||
|
|
||||||
if result == 0 {
|
if result == 0 {
|
||||||
Err(std::io::Error::last_os_error().map_err_context(|| "cannot set date".to_string()))
|
Err(std::io::Error::last_os_error()
|
||||||
|
.map_err_context(|| get_message("date-error-cannot-set-date")))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue