summaryrefslogtreecommitdiff
path: root/subplotlib
diff options
context:
space:
mode:
Diffstat (limited to 'subplotlib')
-rw-r--r--subplotlib/Cargo.toml8
-rw-r--r--subplotlib/src/steplibrary/files.rs11
2 files changed, 12 insertions, 7 deletions
diff --git a/subplotlib/Cargo.toml b/subplotlib/Cargo.toml
index ed3fb8a..7639742 100644
--- a/subplotlib/Cargo.toml
+++ b/subplotlib/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "subplotlib"
-version = "0.1.1"
+version = "0.4.0"
authors = [
"Lars Wirzenius <liw@liw.fi>",
"Daniel Silverstone <dsilvers@digital-scurf.org>",
@@ -16,13 +16,13 @@ repository = "https://gitlab.com/subplot/subplot"
[dependencies]
fehler = "1"
-subplotlib-derive = { version = "0.1", path = "../subplotlib-derive" }
+subplotlib-derive = { version = "0.4.0", path = "../subplotlib-derive" }
lazy_static = "1"
base64 = "0.13"
state = "0.5"
tempfile = "3.1"
fs2 = "0.4"
-chrono = "0.4"
+time = { version = "0.3", features = ["parsing"] }
filetime = "0.2"
regex = "1.4"
shell-words = "1.0"
@@ -32,7 +32,7 @@ remove_dir_all = "0.7"
[build-dependencies]
glob = "0.3"
-subplot-build = { version = "0.1", path = "../subplot-build" }
+subplot-build = { version = "0.4.0", path = "../subplot-build" }
[dev-dependencies]
serde_json = "1.0"
diff --git a/subplotlib/src/steplibrary/files.rs b/subplotlib/src/steplibrary/files.rs
index 991cd88..1a55f7a 100644
--- a/subplotlib/src/steplibrary/files.rs
+++ b/subplotlib/src/steplibrary/files.rs
@@ -10,9 +10,10 @@ use std::io::{self, Write};
use std::path::PathBuf;
use std::time::{Duration, SystemTime};
-use chrono::{TimeZone, Utc};
use filetime::FileTime;
use regex::Regex;
+use time::macros::format_description;
+use time::OffsetDateTime;
pub use crate::prelude::*;
@@ -86,8 +87,12 @@ pub fn create_from_embedded_with_other_name(
/// If the file does not exist, it will be created.
#[step]
pub fn touch_with_timestamp(context: &Datadir, filename: &str, mtime: &str) {
- let ts = Utc.datetime_from_str(mtime, "%Y-%m-%d %H:%M:%S")?;
- let (secs, nanos) = (ts.timestamp(), ts.timestamp_subsec_nanos());
+ let fd = format_description!(
+ "[year]-[month]-[day] [hour]:[minute]:[second] [offset_hour]:[offset_minute]"
+ );
+ let full_time = format!("{} +00:00", mtime);
+ let ts = OffsetDateTime::parse(&full_time, &fd)?;
+ let (secs, nanos) = (ts.unix_timestamp(), 0);
let mtime = FileTime::from_unix_time(secs, nanos);
let full_path = context.canonicalise_filename(filename)?;
// If the file doesn't exist, create it