本文整理汇总了C++中CDateTime::GetAsLocalizedDateTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::GetAsLocalizedDateTime方法的具体用法?C++ CDateTime::GetAsLocalizedDateTime怎么用?C++ CDateTime::GetAsLocalizedDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::GetAsLocalizedDateTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
bool CSavestateWriter::Initialize(const CGameClient* gameClient, uint64_t frameHistoryCount)
{
m_savestate.Reset();
m_fps = 0.0;
m_fps = gameClient->Timing().GetFrameRate();
CDateTime now = CDateTime::GetCurrentDateTime();
std::string label = now.GetAsLocalizedDateTime();
m_savestate.SetType(SAVETYPE::MANUAL);
m_savestate.SetLabel(label);
m_savestate.SetGameClient(gameClient->ID());
m_savestate.SetGamePath(gameClient->GetGamePath());
m_savestate.SetTimestamp(now);
m_savestate.SetPlaytimeFrames(frameHistoryCount);
m_savestate.SetPlaytimeWallClock(frameHistoryCount / m_fps); //! @todo Accumulate playtime instead of deriving it
//! @todo Get CRC from game data instead of filename
Crc32 crc;
crc.Compute(gameClient->GetGamePath());
m_savestate.SetGameCRC(StringUtils::Format("%08x", (unsigned __int32)crc));
m_savestate.SetPath(CSavestateUtils::MakePath(m_savestate));
if (m_savestate.Path().empty())
CLog::Log(LOGDEBUG, "Failed to calculate savestate path");
if (m_fps == 0.0)
return false; // Sanity check
return !m_savestate.Path().empty();
}
示例2: SetFromProperties
void CWeatherJob::SetFromProperties()
{
// Load in our tokens if necessary
if (!m_localizedTokens.size())
LoadLocalizedToken();
CGUIWindow* window = g_windowManager.GetWindow(WINDOW_WEATHER);
if (window)
{
CDateTime time = CDateTime::GetCurrentDateTime();
m_info.lastUpdateTime = time.GetAsLocalizedDateTime(false, false);
m_info.currentConditions = window->GetProperty("Current.Condition").asString();
m_info.currentIcon = ConstructPath(window->GetProperty("Current.OutlookIcon").asString());
LocalizeOverview(m_info.currentConditions);
FormatTemperature(m_info.currentTemperature,
strtol(window->GetProperty("Current.Temperature").asString().c_str(),0,10));
FormatTemperature(m_info.currentFeelsLike,
strtol(window->GetProperty("Current.FeelsLike").asString().c_str(),0,10));
m_info.currentUVIndex = window->GetProperty("Current.UVIndex").asString();
LocalizeOverview(m_info.currentUVIndex);
int speed = ConvertSpeed(strtol(window->GetProperty("Current.Wind").asString().c_str(),0,10));
CStdString direction = window->GetProperty("Current.WindDirection").asString();
if (direction == "CALM")
m_info.currentWind = g_localizeStrings.Get(1410);
else
{
LocalizeOverviewToken(direction);
m_info.currentWind.Format(g_localizeStrings.Get(434).c_str(),
direction, speed, g_langInfo.GetSpeedUnitString().c_str());
}
CStdString windspeed;
windspeed.Format("%i %s",speed,g_langInfo.GetSpeedUnitString().c_str());
window->SetProperty("Current.WindSpeed",windspeed);
FormatTemperature(m_info.currentDewPoint,
strtol(window->GetProperty("Current.DewPoint").asString().c_str(),0,10));
if (window->GetProperty("Current.Humidity").asString().empty())
m_info.currentHumidity.clear();
else
m_info.currentHumidity.Format("%s%%",window->GetProperty("Current.Humidity").asString().c_str());
m_info.location = window->GetProperty("Current.Location").asString();
for (int i=0;i<NUM_DAYS;++i)
{
CStdString strDay;
strDay.Format("Day%i.Title",i);
m_info.forecast[i].m_day = window->GetProperty(strDay).asString();
LocalizeOverviewToken(m_info.forecast[i].m_day);
strDay.Format("Day%i.HighTemp",i);
FormatTemperature(m_info.forecast[i].m_high,
strtol(window->GetProperty(strDay).asString().c_str(),0,10));
strDay.Format("Day%i.LowTemp",i);
FormatTemperature(m_info.forecast[i].m_low,
strtol(window->GetProperty(strDay).asString().c_str(),0,10));
strDay.Format("Day%i.OutlookIcon",i);
m_info.forecast[i].m_icon = ConstructPath(window->GetProperty(strDay).asString());
strDay.Format("Day%i.Outlook",i);
m_info.forecast[i].m_overview = window->GetProperty(strDay).asString();
LocalizeOverview(m_info.forecast[i].m_overview);
}
}
}
示例3: Get
int CEpg::Get(CFileItemList &results) const
{
int iInitialSize = results.Size();
CSingleLock lock(m_critSection);
for (map<CDateTime, CEpgInfoTag *>::const_iterator it = m_tags.begin(); it != m_tags.end(); it++)
{
CDateTime localStartTime;
localStartTime.SetFromUTCDateTime(it->first);
CFileItemPtr entry(new CFileItem(*it->second));
entry->SetLabel2(localStartTime.GetAsLocalizedDateTime(false, false));
results.Add(entry);
}
return results.Size() - iInitialSize;
}