File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,8 @@ publish = false
8
8
[dependencies ]
9
9
tiny_http = " 0.12"
10
10
11
- [dependencies .chrono ]
12
- version = " 0.4"
13
- default-features = false
14
- features = [" std" , " clock" ]
11
+ [dependencies .time ]
12
+ version = " 0.3"
15
13
16
14
[target .'cfg(target_os = "hermit")' .dependencies .hermit-sys ]
17
15
path = " ../../hermit-sys"
Original file line number Diff line number Diff line change 1
1
/// Example is derived from tiny-http example
2
2
/// https://github.com/tiny-http/tiny-http/blob/master/examples/hello-world.rs
3
- use chrono:: { DateTime , Utc } ;
4
3
#[ cfg( target_os = "hermit" ) ]
5
4
use hermit_sys as _;
6
5
@@ -21,11 +20,11 @@ fn main() {
21
20
request. headers( )
22
21
) ;
23
22
24
- let now: DateTime < Utc > = Utc :: now ( ) ;
23
+ let now = time :: OffsetDateTime :: now_utc ( ) ;
25
24
let text = format ! (
26
25
"Hello from RustyHermit {}!\n The current UTC time is {}!\n " ,
27
26
String :: from_utf8( crab. clone( ) ) . unwrap_or_default( ) ,
28
- now. format ( "%Y-%m-%d %H:%M:%S" )
27
+ now
29
28
) ;
30
29
let response = tiny_http:: Response :: from_string ( text) ;
31
30
request. respond ( response) . expect ( "Responded" ) ;
@@ -40,11 +39,11 @@ fn main() {
40
39
request. headers( )
41
40
) ;
42
41
43
- let now: DateTime < Utc > = Utc :: now ( ) ;
42
+ let now = time :: OffsetDateTime :: now_utc ( ) ;
44
43
let text = format ! (
45
44
"Hello from RustyHermit {}!\n The current UTC time is {}!\n " ,
46
45
String :: from_utf8( crab. clone( ) ) . unwrap_or_default( ) ,
47
- now. format ( "%Y-%m-%d %H:%M:%S" )
46
+ now
48
47
) ;
49
48
let response = tiny_http:: Response :: from_string ( text) ;
50
49
request. respond ( response) . expect ( "Responded" ) ;
You can’t perform that action at this time.
0 commit comments