Skip to main content

Crate set_time

Crate set_time 

Source
Expand description

set-time

A simple cross-platform utility library to set the system time for a system

§Example

use set_time::{set_time, Utc, DateTime};

fn main() {
  // Set the system time to January 1, 2020
  let new_time_str = "2020-01-01 00:00:00";
  let new_time = DateTime::parse_from_str(new_time_str, "%Y-%m-%d %H:%M:%S")
      .expect("Failed to parse time");
  set_time(new_time).expect("Failed to set system time");
}

Structs§

DateTime
ISO 8601 combined date and time with time zone.
Utc
The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).

Enums§

SetTimeError

Traits§

Datelike
The common set of methods for date component.
TimeZone
The time zone.
Timelike
The common set of methods for time component.

Functions§

set_time
Sets the system time to the specified time.