void TimeAndPlace::SetSiderialTime(float longitude, float latitude, DateTime* currTime) { AppLog("Trying to access TimeAndPlace"); TimeAndPlace::SetLongitude(longitude); AppLog("Trying to access TimeAndPlace 1"); TimeAndPlace::SetLatitude(latitude); AppLog("Trying to access TimeAndPlace 2"); //TimeZone timeZone(60, L"Europe/London"); LocaleManager localeManager; localeManager.Construct(); Locale locale = localeManager.GetSystemLocale(); TimeZone timeZone = localeManager.GetSystemTimeZone(); AppLog("Locale code %S", (locale.GetLanguageCodeString().GetPointer())); AppLog("TimeZone ID is %S", (timeZone.GetId()).GetPointer()); // TimeZone timeZone(TimeZone::GetGmtTimeZone()); AppLog("TP1"); SystemTime::GetCurrentTime(*currTime); AppLog("TP2"); dateTime = currTime; AppLog("TP2a"); localDateTime = &(timeZone.UtcTimeToStandardTime(*currTime)); Calendar* calendar; AppLog("TP3"); calendar = Calendar::CreateInstanceN(timeZone, CALENDAR_GREGORIAN); AppLog("TP4"); calendar->SetTime(*currTime); AppLog("TP5"); float hrs = (calendar->GetTimeField(TIME_FIELD_HOUR_OF_DAY))-1; AppLog("TP6"); float minHrs = calendar->GetTimeField(TIME_FIELD_MINUTE)/60.0; AppLog("TP7"); float dayFract = (hrs + minHrs)/24.0; AppLog("TP8"); float dayNum = calendar->GetTimeField(TIME_FIELD_DAY_OF_YEAR); AppLog("TP9"); float year = calendar->GetTimeField(TIME_FIELD_YEAR); AppLog("TP10"); double daysSinceJ2000 = -1.5 + dayNum + (year-2000)*365 + (int)((year-2000)/4) + dayFract; AppLog("TP11"); double slt = 100.46 + 0.985647 * daysSinceJ2000 + longitude + 15*(hrs + minHrs); AppLog("TP12"); int sltInt = (int)(slt/360); AppLog("TP13"); float sltHrs = (slt-(360*sltInt))/15; AppLog("TP14"); SetSiderialTime (sltHrs); AppLog("TP15"); }
void TizenSystem::getTimeAndDate(TimeDate &td) const { DateTime 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(); Calendar *calendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN); calendar->SetTime(currentTime); td.tm_wday = calendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1; delete calendar; } }