diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2024-11-06 00:18:04 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2024-11-06 00:18:04 +0100 |
| commit | c8b261535c069c47df70592f2acba35b2c29a54c (patch) | |
| tree | f938d34a4f828dd4aecf52efd5badaf9efdd3d07 /libs/io/src/main/java/org/the_jk/cleversync | |
| parent | 717b7da35d3c38baaf5d975ea76c376ead922211 (diff) | |
Change SingleMerge to only use second precision when comparing last modified
Otherwise you get problems with one file system uses seconds and
another milliseconds and suddenly two files that are created at
the same time does not have the same timestamp.
Makes the test suite take 2 seconds longer to run but it is
what it is.
Diffstat (limited to 'libs/io/src/main/java/org/the_jk/cleversync')
| -rw-r--r-- | libs/io/src/main/java/org/the_jk/cleversync/io/SingleMerge.kt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/io/src/main/java/org/the_jk/cleversync/io/SingleMerge.kt b/libs/io/src/main/java/org/the_jk/cleversync/io/SingleMerge.kt index f9107db..711daae 100644 --- a/libs/io/src/main/java/org/the_jk/cleversync/io/SingleMerge.kt +++ b/libs/io/src/main/java/org/the_jk/cleversync/io/SingleMerge.kt @@ -100,7 +100,10 @@ object SingleMerge { } else { val targetFile = targetContent.files.find { it.name == sourceName } if (targetFile != null) { - if (targetFile.size != sourceSize || sourceLastModified > targetFile.lastModified) { + // When comparing times, reduce to nearest second, anything else + // over network based filesystems is just silly. + if (targetFile.size != sourceSize || + sourceLastModified.epochSecond > targetFile.lastModified.epochSecond) { actions.add(Action.Copy(sourceName, overwrite = true)) } } else { |
