GitHub: Use Time.timestamp instead of Date.now

The timestamp is now Epoch Unix style (in seconds rather than ms)
This commit is contained in:
quadbyte 2025-08-12 14:26:00 -04:00
parent 0d196b2917
commit e3ff4e5bcf

View file

@ -57,13 +57,13 @@ Singleton {
// -------------------------------- // --------------------------------
function loadFromCache() { function loadFromCache() {
const now = Date.now() const now = Time.timestamp
if (!data.timestamp || (now - data.timestamp > githubUpdateFrequency * 1000)) { if (!data.timestamp || (now >= data.timestamp + githubUpdateFrequency)) {
console.log("[GitHub] Cache expired or missing, fetching new data from GitHub...") console.log("[GitHub] Cache expired or missing, fetching new data from GitHub...")
fetchFromGitHub() fetchFromGitHub()
return return
} }
console.log("[GitHub] Loading cached GitHub data (age:", Math.round((now - data.timestamp) / 60000),"minutes)") console.log("[GitHub] Loading cached GitHub data (age:", Math.round((now - data.timestamp) / 60), "minutes)")
if (data.version) { if (data.version) {
root.latestVersion = data.version root.latestVersion = data.version
@ -87,7 +87,7 @@ Singleton {
// -------------------------------- // --------------------------------
function saveData() { function saveData() {
data.timestamp = Date.now() data.timestamp = Time.timestamp
Qt.callLater(() => { Qt.callLater(() => {
// Access the FileView's writeAdapter method // Access the FileView's writeAdapter method
var fileView = root.children.find(child => child.objectName === "githubDataFileView") var fileView = root.children.find(child => child.objectName === "githubDataFileView")