本文整理汇总了C++中TimeZone::UtcTimeToWallTime方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeZone::UtcTimeToWallTime方法的具体用法?C++ TimeZone::UtcTimeToWallTime怎么用?C++ TimeZone::UtcTimeToWallTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeZone
的用法示例。
在下文中一共展示了TimeZone::UtcTimeToWallTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyPattern
DateTime*
TimeAndPlace::GetStandardDateTime(void) {
LocaleManager localeManager;
localeManager.Construct();
Locale locale = localeManager.GetSystemLocale();
TimeZone timeZone = localeManager.GetSystemTimeZone();
AppLog("GMT Time Zone id is %S", timeZone.GetGmtTimeZone().GetId().GetPointer());
AppLog("Time Zone is %S", timeZone.GetId().GetPointer());
AppLog("Time Zone offset is %d", timeZone.GetRawOffset());
AppLog("Time Zone DST is %d", timeZone.GetDstSavings());
result r;
String customizedPattern = L"HH:mm:ss zzz";
String readableDateTime;
DateTimeFormatter* formatter = DateTimeFormatter::CreateDateFormatterN();
r = formatter -> ApplyPattern(customizedPattern);
AppLog("formatter -> ApplyPattern(customizedPattern) result is %s", GetErrorMessage(r));
DateTime standardOffsetDateTime = timeZone.UtcTimeToStandardTime(*dateTime, timeZone.GetRawOffset());
r = formatter -> Format(standardOffsetDateTime, readableDateTime);
AppLog("Standard Local Time is %S", readableDateTime.GetPointer());
readableDateTime.Clear();
DateTime standardDateTime = timeZone.UtcTimeToStandardTime(*dateTime);
r = formatter -> Format(standardDateTime, readableDateTime);
AppLog("Standard Time is %S", readableDateTime.GetPointer());
readableDateTime.Clear();
DateTime wallDateTime = timeZone.UtcTimeToWallTime(*dateTime);
r = formatter -> Format(wallDateTime, readableDateTime);
AppLog("Wall Time is %S", readableDateTime.GetPointer());
readableDateTime.Clear();
r = formatter -> Format(*dateTime, readableDateTime);
AppLog("UTC Time is %S", readableDateTime.GetPointer());
readableDateTime.Clear();
// Calendar* calendar = Calendar::CreateInstanceN(timeZone, CALENDAR_GREGORIAN);
// DateTime localTime1 = calendar -> GetTime();
// r = formatter -> Format(localTime1, readableDateTime);
// AppLog("Local Time is %S", readableDateTime.GetPointer());
return localDateTime;
}
示例2: GetErrorMessage
void
EditEventForm::LoadEvent(void)
{
result r = E_SUCCESS;
// Loads the Subject
__pSubjectEditField->SetText(__pCalEvent->GetSubject());
// Loads the Time
DateTime startDate = __pCalEvent->GetStartTime();
DateTime endDate = __pCalEvent->GetEndTime();
if (__pCalEvent->IsAllDayEvent() == true)
{
__pIsAllDayButton->SetSelected(true);
// Start Date
__pStartEditDate->SetDate(startDate);
__pStartEditTime->SetShowState(false);
// End Date
if(startDate < endDate)
{
endDate.AddDays(-1);
}
__pEndEditDate->SetDate(endDate);
__pEndEditTime->SetShowState(false);
}
else
{
// Convert UTC time to local time
LocaleManager localeManager;
r = localeManager.Construct();
TryReturnVoid(!IsFailed(r), "[%s] Failed to construct localeManager.", GetErrorMessage(r));
TimeZone timeZone = localeManager.GetSystemTimeZone();
startDate = timeZone.UtcTimeToWallTime(startDate);
endDate = timeZone.UtcTimeToWallTime(endDate);
// Start Date
__pStartEditDate->SetDate(startDate);
__pStartEditTime->SetTime(startDate);
// End Date
__pEndEditDate->SetDate(endDate);
__pEndEditTime->SetTime(endDate);
}
// Loads the Location
__pLocationEditField->SetText(__pCalEvent->GetLocation());
// Loads the Priority
__selectedPriority = __pCalEvent->GetPriority();
switch (__selectedPriority)
{
case EVENT_PRIORITY_LOW:
__pPriorityContextButton->SetText(L"Low");
break;
case EVENT_PRIORITY_NORMAL:
__pPriorityContextButton->SetText(L"Normal");
break;
case EVENT_PRIORITY_HIGH:
__pPriorityContextButton->SetText(L"High");
break;
default:
break;
}
// Loads the Sensitivity
__selectedSensitivity = __pCalEvent->GetSensitivity();
switch (__selectedSensitivity)
{
case SENSITIVITY_PUBLIC:
__pSensitivityContextButton->SetText(L"Public");
break;
case SENSITIVITY_PRIVATE:
__pSensitivityContextButton->SetText(L"Private");
break;
case SENSITIVITY_CONFIDENTIAL:
__pSensitivityContextButton->SetText(L"Confidential");
break;
default:
break;
}
// Loads the Status
__selectedStatus = __pCalEvent->GetStatus();
switch (__selectedStatus)
{
case EVENT_STATUS_NONE:
__pStatusContextButton->SetText(L"None");
break;
case EVENT_STATUS_CONFIRMED:
//.........这里部分代码省略.........