From b2f5721e58e94b918c5b7032e315396f4fb6c51d Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 9 Jun 2012 20:20:19 -0400 Subject: COMMON: Add tm_wday to our TimeDate struct Did not adapt bada or ps2 backends as I'm not sure how they should be handled --- backends/platform/bada/system.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'backends/platform/bada/system.cpp') diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp index d284688068..29ce954eba 100644 --- a/backends/platform/bada/system.cpp +++ b/backends/platform/bada/system.cpp @@ -399,6 +399,7 @@ void BadaSystem::getTimeAndDate(TimeDate &td) const { td.tm_mday = currentTime.GetDay(); td.tm_mon = currentTime.GetMonth(); td.tm_year = currentTime.GetYear(); + td.tm_wday = 0; // FIXME } } -- cgit v1.2.3 From 249d48f77b395d82b8f2bb67360c5539212f5bc4 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 10 Jun 2012 14:53:26 -0400 Subject: BACKENDS: Add #error for platforms not setting tm_wday in release builds --- backends/platform/bada/system.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backends/platform/bada/system.cpp') diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp index 29ce954eba..816a6755fc 100644 --- a/backends/platform/bada/system.cpp +++ b/backends/platform/bada/system.cpp @@ -399,7 +399,11 @@ void BadaSystem::getTimeAndDate(TimeDate &td) const { td.tm_mday = currentTime.GetDay(); td.tm_mon = currentTime.GetMonth(); td.tm_year = currentTime.GetYear(); +#ifdef RELEASE_BUILD + #error getTimeAndDate() is not setting the day of the week +#else td.tm_wday = 0; // FIXME +#endif } } -- cgit v1.2.3 From 7b44c20eb114515a1117df7f930ed98af0528db4 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 25 Jun 2012 19:59:46 +0200 Subject: BADA: Implement weekday querying in getTimeAndDate. This furthermore makes the returned time be the wall time instead of UTC. Thanks to Chris Warren-Smith for testing and improving a patch based on pull request #248. --- backends/platform/bada/system.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'backends/platform/bada/system.cpp') diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp index 816a6755fc..3f862c2571 100644 --- a/backends/platform/bada/system.cpp +++ b/backends/platform/bada/system.cpp @@ -21,6 +21,7 @@ */ #include +#include #include "common/config-manager.h" #include "common/file.h" @@ -42,7 +43,9 @@ using namespace Osp::Base; using namespace Osp::Base::Runtime; +using namespace Osp::Locales; using namespace Osp::Ui::Controls; +using namespace Osp::System; #define DEFAULT_CONFIG_FILE "/Home/scummvm.ini" #define RESOURCE_PATH "/Res" @@ -305,7 +308,7 @@ void BadaSystem::initBackend() { ConfMan.registerDefault("aspect_ratio", false); ConfMan.setBool("confirm_exit", false); - Osp::System::SystemTime::GetTicks(_epoch); + SystemTime::GetTicks(_epoch); if (E_SUCCESS != initModules()) { AppLog("initModules failed"); @@ -372,7 +375,7 @@ bool BadaSystem::pollEvent(Common::Event &event) { uint32 BadaSystem::getMillis() { long long result, ticks = 0; - Osp::System::SystemTime::GetTicks(ticks); + SystemTime::GetTicks(ticks); result = ticks - _epoch; return result; } @@ -392,18 +395,18 @@ void BadaSystem::updateScreen() { void BadaSystem::getTimeAndDate(TimeDate &td) const { DateTime currentTime; - if (E_SUCCESS == Osp::System::SystemTime::GetCurrentTime(currentTime)) { + if (E_SUCCESS == SystemTime::GetCurrentTime(WALL_TIME, currentTime)) { td.tm_sec = currentTime.GetSecond(); td.tm_min = currentTime.GetMinute(); td.tm_hour = currentTime.GetHour(); td.tm_mday = currentTime.GetDay(); td.tm_mon = currentTime.GetMonth(); td.tm_year = currentTime.GetYear(); -#ifdef RELEASE_BUILD - #error getTimeAndDate() is not setting the day of the week -#else - td.tm_wday = 0; // FIXME -#endif + + Calendar *calendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); + calendar->SetTime(currentTime); + td.tm_wday = calendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1; + delete calendar; } } -- cgit v1.2.3