当前位置: 首页>>代码示例>>C++>>正文


C++ CDateTime::GetAsLocalizedDateTime方法代码示例

本文整理汇总了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();
}
开发者ID:Elzevir,项目名称:xbmc,代码行数:32,代码来源:SavestateWriter.cpp

示例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);
    }
  }
}
开发者ID:AFFLUENTSOCIETY,项目名称:SPMC,代码行数:60,代码来源:Weather.cpp

示例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;
}
开发者ID:Omel,项目名称:xbmc,代码行数:18,代码来源:Epg.cpp


注:本文中的CDateTime::GetAsLocalizedDateTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。