Merge pull request #2324 from PokerFace8/issue2316

Replace instances of new Date().getTime() with System.currentTimeMillis()

Fixes #2316
This commit is contained in:
cketti 2017-03-03 09:12:40 +01:00 committed by GitHub
commit 703b6532b7
2 changed files with 2 additions and 2 deletions

View file

@ -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) {

View file

@ -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) {