Skip to content

Commit faf0a16

Browse files
committed
swtch from the chrono crate to the time crate
1 parent c6577bf commit faf0a16

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

examples/httpd/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ publish = false
88
[dependencies]
99
tiny_http = "0.12"
1010

11-
[dependencies.chrono]
12-
version = "0.4"
13-
default-features = false
14-
features = ["std", "clock"]
11+
[dependencies.time]
12+
version = "0.3"
1513

1614
[target.'cfg(target_os = "hermit")'.dependencies.hermit-sys]
1715
path = "../../hermit-sys"

examples/httpd/src/main.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// Example is derived from tiny-http example
22
/// https://github.com/tiny-http/tiny-http/blob/master/examples/hello-world.rs
3-
use chrono::{DateTime, Utc};
43
#[cfg(target_os = "hermit")]
54
use hermit_sys as _;
65

@@ -21,11 +20,11 @@ fn main() {
2120
request.headers()
2221
);
2322

24-
let now: DateTime<Utc> = Utc::now();
23+
let now = time::OffsetDateTime::now_utc();
2524
let text = format!(
2625
"Hello from RustyHermit {}!\nThe current UTC time is {}!\n",
2726
String::from_utf8(crab.clone()).unwrap_or_default(),
28-
now.format("%Y-%m-%d %H:%M:%S")
27+
now
2928
);
3029
let response = tiny_http::Response::from_string(text);
3130
request.respond(response).expect("Responded");
@@ -40,11 +39,11 @@ fn main() {
4039
request.headers()
4140
);
4241

43-
let now: DateTime<Utc> = Utc::now();
42+
let now = time::OffsetDateTime::now_utc();
4443
let text = format!(
4544
"Hello from RustyHermit {}!\nThe current UTC time is {}!\n",
4645
String::from_utf8(crab.clone()).unwrap_or_default(),
47-
now.format("%Y-%m-%d %H:%M:%S")
46+
now
4847
);
4948
let response = tiny_http::Response::from_string(text);
5049
request.respond(response).expect("Responded");

0 commit comments

Comments
 (0)