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
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
use anyhow::{Error};
|
||||
use serde_json::Value;
|
||||
use chrono::{Local, TimeZone, LocalResult};
|
||||
|
||||
pub fn strip_server_file_expenstion(name: &str) -> String {
|
||||
|
||||
@ -25,9 +24,10 @@ pub fn render_epoch(value: &Value, _record: &Value) -> Result<String, Error> {
|
||||
if value.is_null() { return Ok(String::new()); }
|
||||
let text = match value.as_i64() {
|
||||
Some(epoch) => {
|
||||
match Local.timestamp_opt(epoch, 0) {
|
||||
LocalResult::Single(epoch) => epoch.format("%c").to_string(),
|
||||
_ => epoch.to_string(),
|
||||
if let Ok(epoch_string) = proxmox::tools::time::strftime_local("%c", epoch as i64) {
|
||||
epoch_string
|
||||
} else {
|
||||
epoch.to_string()
|
||||
}
|
||||
},
|
||||
None => {
|
||||
|
Reference in New Issue
Block a user