Fix use of deprecated time::OffsetDateTime::now_local()
This commit is contained in:
1 parent
b8118dadc9
commit
f4612b8f8d
1 file changed
+5
-1
+5
-1
@@ -239,7 +239,11 @@ fn do_camera_management(
|
||||
camera_config.name, time
|
||||
);
|
||||
} else {
|
||||
let new_time = time::OffsetDateTime::now_local();
|
||||
use time::OffsetDateTime;
|
||||
// We'd like now_local() but it's deprecated - try to get the local time, but if no
|
||||
// time zone, fall back to UTC.
|
||||
let new_time = OffsetDateTime::try_now_local().unwrap_or(OffsetDateTime::now_utc());
|
||||
|
||||
warn!(
|
||||
"{}: Camera has no time set, setting to {}",
|
||||
camera_config.name, new_time
|
||||
|
||||
Reference in new issue
Block a user