diff --git a/.classpath b/.classpath
index cad48e8..e2a62f4 100644
--- a/.classpath
+++ b/.classpath
@@ -36,5 +36,10 @@
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index 9a75992..8ff95e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
/build
/dist
*~
+/.apt_generated/
diff --git a/.settings/org.eclipse.jdt.apt.core.prefs b/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 0000000..fa6bcfb
--- /dev/null
+++ b/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=true
+org.eclipse.jdt.apt.genSrcDir=.apt_generated
+org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests
+org.eclipse.jdt.apt.reconcileEnabled=true
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 12af6a4..20e85e6 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -21,6 +21,7 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
index 9ddc361..a0a7b2e 100644
--- a/.settings/org.eclipse.jdt.ui.prefs
+++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -152,6 +152,7 @@ org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.text.custom_code_templates=
sp_cleanup.add_all=false
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 8557b74..8e52c05 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,6 +1,12 @@
-
+
+
+
+
+
+
+
diff --git a/src/fr/devinsy/statoolinfos/core/StatoolInfosContext.java b/src/fr/devinsy/statoolinfos/core/StatoolInfosContext.java
index 40bc777..af1de1a 100644
--- a/src/fr/devinsy/statoolinfos/core/StatoolInfosContext.java
+++ b/src/fr/devinsy/statoolinfos/core/StatoolInfosContext.java
@@ -21,6 +21,8 @@ package fr.devinsy.statoolinfos.core;
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
import fr.devinsy.statoolinfos.crawl.CrawlCache;
import fr.devinsy.statoolinfos.uptime.UptimeJournal;
@@ -32,6 +34,7 @@ public class StatoolInfosContext
{
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StatoolInfosContext.class);
+ private LocalDateTime initDateTime;
private Configuration configuration;
private Federation federation;
private Categories categories;
@@ -81,6 +84,7 @@ public class StatoolInfosContext
this.categories = Factory.loadCategories(categoriesURL, this.federation);
}
this.uptimeJournal = this.cache.restoreUptimeJournal();
+ this.initDateTime = LocalDateTime.now();
System.out.println("Loaded configuration context in " + (System.currentTimeMillis() - startTime) + " ms.");
}
else
@@ -158,4 +162,31 @@ public class StatoolInfosContext
{
return this.uptimeJournal;
}
+
+ /**
+ * Checks if is expired.
+ *
+ * @return true, if is expired
+ */
+ public boolean isExpired()
+ {
+ boolean result;
+
+ getCache();
+
+ long cacheTime = this.getCache().getDirectory().lastModified();
+ LocalDateTime cacheDateTime = LocalDateTime.ofEpochSecond(cacheTime / 1000, 0, OffsetDateTime.now().getOffset());
+
+ if (cacheDateTime.isAfter(this.initDateTime))
+ {
+ result = true;
+ }
+ else
+ {
+ result = false;
+ }
+
+ //
+ return result;
+ }
}