implement relead_timezone flag

This commit is contained in:
Dietmar Maurer
2019-02-01 09:54:56 +01:00
parent c82bc1a1f9
commit 4b2cdeb9a6
3 changed files with 28 additions and 8 deletions

View File

@ -32,10 +32,6 @@ fn get_time(
}))
}
extern "C" { fn tzset(); }
// Note:: this needs root rights ??
fn set_timezone(
param: Value,
_info: &ApiMethod,
@ -57,8 +53,6 @@ fn set_timezone(
use std::os::unix::fs::symlink;
symlink(path, "/etc/localtime")?;
unsafe { tzset() };
Ok(Value::Null)
}
@ -83,7 +77,7 @@ pub fn router() -> Router {
set_timezone,
ObjectSchema::new("Set time zone.")
.required("timezone", StringSchema::new("Time zone. The file '/usr/share/zoneinfo/zone.tab' contains the list of valid names."))
).protected(true)
).protected(true).reload_timezone(true)
);