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

This commit is contained in:
Subhaprada Chand 2017-03-03 05:25:22 +05:30
parent 88a86a14c3
commit 0b2c2e4692
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) {