1
5
mirror of https://github.com/vinc/moros.git synced 2024-06-15 05:36:38 +00:00
moros/src/usr/date.rs
Vincent Ollivier f1a19e2055
Improve HTTP server (#391)
* Link host 8080 port to qemu 80

* Add root dir

* Add support for images

* Add Response struct

* Refactor response buffer creation

* Add index file support

* Copy www dir

* Update trailing slash rule

* Add command line arguments

* Remove strftime function

* Add read only mode

* Implement Display

* Add colored output

* Add Request struct

* Add common date time format

* Add time::now_utc

* Add connexions pool

* Reduce wait time

* Add install --yes

* Fix typo

* Add more mime types
2022-08-25 08:42:35 +02:00

19 lines
505 B
Rust

use crate::api;
use crate::api::clock::DATE_TIME_ZONE;
use crate::api::process::ExitCode;
use time::validate_format_string;
pub fn main(args: &[&str]) -> Result<(), ExitCode> {
let format = if args.len() > 1 { args[1] } else { DATE_TIME_ZONE };
match validate_format_string(format) {
Ok(()) => {
println!("{}", api::time::now().format(format));
Ok(())
}
Err(e) => {
error!("{}", e);
Err(ExitCode::Failure)
}
}
}