Move back to chrono

This commit is contained in:
Anthony J. Martinez 2021-12-14 14:53:16 -06:00
parent e5b8265658
commit acc3e0fc87
Signed by: ajmartinez
GPG Key ID: A2206FDD769DBCFC
3 changed files with 8 additions and 22 deletions

15
Cargo.lock generated
View File

@ -28,9 +28,10 @@ checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203"
[[package]]
name = "arse"
version = "0.13.0"
version = "0.14.0"
dependencies = [
"anyhow",
"chrono",
"clap",
"glob",
"hyper",
@ -43,7 +44,6 @@ dependencies = [
"simplelog",
"tempfile",
"tera",
"time 0.3.5",
"tokio",
"toml",
]
@ -146,7 +146,7 @@ dependencies = [
"libc",
"num-integer",
"num-traits",
"time 0.1.43",
"time",
"winapi",
]
@ -1154,15 +1154,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "time"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad"
dependencies = [
"libc",
]
[[package]]
name = "tokio"
version = "1.14.0"

View File

@ -1,6 +1,6 @@
[package]
name = "arse"
version = "0.13.0"
version = "0.14.0"
authors = ["Anthony Martinez"]
edition = "2021"
license = "MIT OR Apache-2.0"
@ -15,7 +15,7 @@ categories = ["command-line-utilities", "web-programming::http-server"]
[dependencies]
anyhow = "1.0"
time = "0.3"
chrono = "0.4"
clap = "2"
glob = "0.3.0"
hyper = "0.14"

View File

@ -13,17 +13,16 @@ copied, modified, or distributed except according to those terms.
use std::fs::File;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::SystemTime;
use super::common;
use super::config::AppConfig;
use super::{Context, Result};
use chrono::{DateTime, Utc};
use log::{debug, trace};
use pulldown_cmark::{html, Parser};
use rss::{Channel, Item};
use tera::{Context as TemplateContext, Tera};
use time::OffsetDateTime;
/// Static defaults for the rendering engine.g
mod default;
@ -229,13 +228,9 @@ impl Engine {
path.file_stem().unwrap().to_str().unwrap()
);
let f = File::open(&path)?;
let updated = f
.metadata()?
.modified()?
.duration_since(SystemTime::UNIX_EPOCH)?
.as_secs() as i64;
let updated: DateTime<Utc> = f.metadata()?.modified()?.into();
let updated = OffsetDateTime::from_unix_timestamp(updated)?.to_string();
let updated = updated.to_rfc2822();
let description = Self::read_post_to_html(path)?;