[Scummvm-cvs-logs] scummvm master -> c18a12453ed7702e3ced87d5f42acf7d10b6b41d

sev- sev at scummvm.org
Sat Apr 9 17:20:13 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c18a12453e UPDATES: Implemented method getLastUpdateCheckTimeAndDate()


Commit: c18a12453ed7702e3ced87d5f42acf7d10b6b41d
    https://github.com/scummvm/scummvm/commit/c18a12453ed7702e3ced87d5f42acf7d10b6b41d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-09T17:04:04+02:00

Commit Message:
UPDATES: Implemented method getLastUpdateCheckTimeAndDate()

Currently it uses methods and constants deprecated in 10.10.
10.10+ -specific code will follow

Changed paths:
    backends/updates/macosx/macosx-updates.h
    backends/updates/macosx/macosx-updates.mm
    common/updates.h



diff --git a/backends/updates/macosx/macosx-updates.h b/backends/updates/macosx/macosx-updates.h
index 9f541ad..6fb9af7 100644
--- a/backends/updates/macosx/macosx-updates.h
+++ b/backends/updates/macosx/macosx-updates.h
@@ -41,6 +41,8 @@ public:
 
 	virtual void setUpdateCheckInterval(int interval);
 	virtual int getUpdateCheckInterval();
+
+	virtual bool getLastUpdateCheckTimeAndDate(TimeDate &t);
 };
 
 #endif
diff --git a/backends/updates/macosx/macosx-updates.mm b/backends/updates/macosx/macosx-updates.mm
index fc967f8..273d80a 100644
--- a/backends/updates/macosx/macosx-updates.mm
+++ b/backends/updates/macosx/macosx-updates.mm
@@ -23,6 +23,7 @@
 // Disable symbol overrides so that we can use system headers.
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
+#include "common/system.h"
 #include "backends/updates/macosx/macosx-updates.h"
 
 #ifdef USE_SPARKLE
@@ -133,4 +134,20 @@ int MacOSXUpdateManager::getUpdateCheckInterval() {
 	}
 }
 
+bool MacOSXUpdateManager::getLastUpdateCheckTimeAndDate(TimeDate &t) {
+	NSDate *date = [sparkleUpdater lastUpdateCheckDate];
+	NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
+	NSDateComponents *components = [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:date];
+
+	t.tm_wday = [components weekday];
+	t.tm_year = [components year];
+	t.tm_mon = [components month];
+	t.tm_mday = [components day];
+	t.tm_hour = [components hour];
+	t.tm_min = [components minute];
+	t.tm_sec = [components second];
+
+	return true;
+}
+
 #endif
diff --git a/common/updates.h b/common/updates.h
index 65eb5ac..3a3049d 100644
--- a/common/updates.h
+++ b/common/updates.h
@@ -95,6 +95,14 @@ public:
 	virtual int getUpdateCheckInterval() { return kUpdateIntervalNotSupported; }
 
 	/**
+	 * Gets last update check time
+	 *
+	 * @param  t    TimeDate struct to fill out
+	 * @return flag indicating success
+	 */
+	virtual bool getLastUpdateCheckTimeAndDate(TimeDate &t) { return false; }
+
+	/**
 	 * Returns list of supported uptate intervals.
 	 * Ending with '-1' which is not acceptable value.
 	 *






More information about the Scummvm-git-logs mailing list