error[E0698]: type inside `async` block must be known in this context
--> src/main.rs:729:24
|
729 | let current_time = chrono::offset::TimeZone::from_offset(&offset);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
note: the type is part of the `async` block because of this `await`
--> src/main.rs:966:11
|
966 | .run()
| ___________^
967 | | .await
| |__________^
TimeZone::from_offset returns Self, that is, the type which implements TimeZone, and that time is, well, the time zone, not the time. You probably want Utc::now().with_timezone(&timezone).
let offset = chrono::FixedOffset::east(3600);
let timezone: chrono::FixedOffset = chrono::offset::TimeZone::from_offset(&offset);
let current_time = chrono::Utc::now().with_timezone(&timezone);
println!("{:?}", current_time);