From dc12cf44aa47912dd66461d5ef11dd84ea0df088 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 12 Sep 2020 15:10:47 +0200 Subject: [PATCH] avoid chrono dependency, depend on proxmox 0.3.8 - remove chrono dependency - depend on proxmox 0.3.8 - remove epoch_now, epoch_now_u64 and epoch_now_f64 - remove tm_editor (moved to proxmox crate) - use new helpers from proxmox 0.3.8 * epoch_i64 and epoch_f64 * parse_rfc3339 * epoch_to_rfc3339_utc * strftime_local - BackupDir changes: * store epoch and rfc3339 string instead of DateTime * backup_time_to_string now return a Result * remove unnecessary TryFrom<(BackupGroup, i64)> for BackupDir - DynamicIndexHeader: change ctime to i64 - FixedIndexHeader: change ctime to i64 --- src/tools/file_logger.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/file_logger.rs b/src/tools/file_logger.rs index c0fcab78..c41994f1 100644 --- a/src/tools/file_logger.rs +++ b/src/tools/file_logger.rs @@ -1,5 +1,4 @@ use anyhow::{Error}; -use chrono::Local; use std::io::Write; /// Log messages with timestamps into files @@ -56,7 +55,10 @@ impl FileLogger { stdout.write_all(b"\n").unwrap(); } - let line = format!("{}: {}\n", Local::now().to_rfc3339(), msg); + let now = proxmox::tools::time::epoch_i64(); + let rfc3339 = proxmox::tools::time::epoch_to_rfc3339(now).unwrap(); + + let line = format!("{}: {}\n", rfc3339, msg); self.file.write_all(line.as_bytes()).unwrap(); } }