diff --git a/k9mail/src/main/java/com/fsck/k9/provider/AttachmentTempFileProvider.java b/k9mail/src/main/java/com/fsck/k9/provider/AttachmentTempFileProvider.java index ce5a06172..f81631732 100644 --- a/k9mail/src/main/java/com/fsck/k9/provider/AttachmentTempFileProvider.java +++ b/k9mail/src/main/java/com/fsck/k9/provider/AttachmentTempFileProvider.java @@ -95,7 +95,7 @@ public class AttachmentTempFileProvider extends FileProvider { public static boolean deleteOldTemporaryFiles(Context context) { File tempDirectory = getTempFileDirectory(context); boolean allFilesDeleted = true; - long deletionThreshold = new Date().getTime() - FILE_DELETE_THRESHOLD_MILLISECONDS; + long deletionThreshold = System.currentTimeMillis() - FILE_DELETE_THRESHOLD_MILLISECONDS; for (File tempFile : tempDirectory.listFiles()) { long lastModified = tempFile.lastModified(); if (lastModified < deletionThreshold) { diff --git a/k9mail/src/main/java/com/fsck/k9/provider/DecryptedFileProvider.java b/k9mail/src/main/java/com/fsck/k9/provider/DecryptedFileProvider.java index 653e42433..32f61be99 100644 --- a/k9mail/src/main/java/com/fsck/k9/provider/DecryptedFileProvider.java +++ b/k9mail/src/main/java/com/fsck/k9/provider/DecryptedFileProvider.java @@ -74,7 +74,7 @@ public class DecryptedFileProvider extends FileProvider { public static boolean deleteOldTemporaryFiles(Context context) { File tempDirectory = getDecryptedTempDirectory(context); boolean allFilesDeleted = true; - long deletionThreshold = new Date().getTime() - FILE_DELETE_THRESHOLD_MILLISECONDS; + long deletionThreshold = System.currentTimeMillis() - FILE_DELETE_THRESHOLD_MILLISECONDS; for (File tempFile : tempDirectory.listFiles()) { long lastModified = tempFile.lastModified(); if (lastModified < deletionThreshold) {