From 481a4a9746296f726ff199d12d58300a25a325e2 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 15 Aug 2023 20:45:29 +0200 Subject: Use nanosecs for backup dirname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The user doesn’t need this level of precision, but using seconds might cause problems if two processes are spawned in quick succession to each other. Since we have the options, why not use the most precise one? --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index bf7c142..ed2a119 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,7 +153,7 @@ fn work() -> Result<(), io::Error> { let mut cache_dir = PathBuf::default(); if flags.backup { let ts = require!(SystemTime::now().duration_since(UNIX_EPOCH)) - .as_secs() + .as_nanos() .to_string(); let cache_base = env::var("XDG_CACHE_HOME").unwrap_or_else(|_| { err!("XDG_CACHE_HOME variable must be set"); -- cgit v1.2.3