aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-08-15 20:45:29 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-08-15 20:45:29 +0200
commit481a4a9746296f726ff199d12d58300a25a325e2 (patch)
tree80700bf4bb60b6c1ee29982ad9aec2eb870894d6
parentdb2c23ea0e3eb0fbc4579a1024b3c6220c9f9a4c (diff)
Use nanosecs for backup dirname
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?
-rw-r--r--src/main.rs2
1 files changed, 1 insertions, 1 deletions
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");