本文整理汇总了C++中CDateTime::SetDateTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::SetDateTime方法的具体用法?C++ CDateTime::SetDateTime怎么用?C++ CDateTime::SetDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::SetDateTime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadDateTime
void CGUIDialogPVRGuideSearch::ReadDateTime(const std::string &strDate, const std::string &strTime, CDateTime &dateTime) const
{
int iHours, iMinutes;
sscanf(strTime.c_str(), "%d:%d", &iHours, &iMinutes);
dateTime.SetFromDBDate(strDate);
dateTime.SetDateTime(dateTime.GetYear(), dateTime.GetMonth(), dateTime.GetDay(), iHours, iMinutes, 0);
}
示例2: SetTimeFromSystemTime
void CGUIDialogPVRTimerSettings::SetTimeFromSystemTime(CDateTime &datetime, const SYSTEMTIME &time)
{
const CDateTime newTime(time);
datetime.SetDateTime(
datetime.GetYear(), datetime.GetMonth(), datetime.GetDay(),
newTime.GetHour(), newTime.GetMinute(), newTime.GetSecond());
}
示例3: SetDateFromIndex
void CGUIDialogPVRTimerSettings::SetDateFromIndex(CDateTime &datetime, int date)
{
const CDateTime newDate(static_cast<time_t>(date));
datetime.SetDateTime(
newDate.GetYear(), newDate.GetMonth(), newDate.GetDay(),
datetime.GetHour(), datetime.GetMinute(), datetime.GetSecond());
}
示例4: GetNextEventTime
CDateTime CPVRTimers::GetNextEventTime(void) const
{
const bool dailywakup = CSettings::GetInstance().GetBool(CSettings::SETTING_PVRPOWERMANAGEMENT_DAILYWAKEUP);
const CDateTime now = CDateTime::GetUTCDateTime();
const CDateTimeSpan prewakeup(0, 0, CSettings::GetInstance().GetInt(CSettings::SETTING_PVRPOWERMANAGEMENT_PREWAKEUP), 0);
const CDateTimeSpan idle(0, 0, CSettings::GetInstance().GetInt(CSettings::SETTING_PVRPOWERMANAGEMENT_BACKENDIDLETIME), 0);
CDateTime wakeuptime;
/* Check next active time */
CFileItemPtr item = GetNextActiveTimer();
if (item && item->HasPVRTimerInfoTag())
{
const CDateTimeSpan prestart(0, 0, item->GetPVRTimerInfoTag()->MarginStart(), 0);
const CDateTime start = item->GetPVRTimerInfoTag()->StartAsUTC();
wakeuptime = ((start - prestart - prewakeup - idle) > now) ?
start - prestart - prewakeup :
now + idle;
}
/* check daily wake up */
if (dailywakup)
{
CDateTime dailywakeuptime;
dailywakeuptime.SetFromDBTime(CSettings::GetInstance().GetString(CSettings::SETTING_PVRPOWERMANAGEMENT_DAILYWAKEUPTIME));
dailywakeuptime = dailywakeuptime.GetAsUTCDateTime();
dailywakeuptime.SetDateTime(
now.GetYear(), now.GetMonth(), now.GetDay(),
dailywakeuptime.GetHour(), dailywakeuptime.GetMinute(), dailywakeuptime.GetSecond()
);
if ((dailywakeuptime - idle) < now)
{
const CDateTimeSpan oneDay(1,0,0,0);
dailywakeuptime += oneDay;
}
if (!wakeuptime.IsValid() || dailywakeuptime < wakeuptime)
wakeuptime = dailywakeuptime;
}
const CDateTime retVal(wakeuptime);
return retVal;
}
示例5: GetNextEventTime
CDateTime CPVRTimers::GetNextEventTime(void) const
{
const bool dailywakup = m_settings.GetBoolValue(CSettings::SETTING_PVRPOWERMANAGEMENT_DAILYWAKEUP);
const CDateTime now = CDateTime::GetUTCDateTime();
const CDateTimeSpan prewakeup(0, 0, m_settings.GetIntValue(CSettings::SETTING_PVRPOWERMANAGEMENT_PREWAKEUP), 0);
const CDateTimeSpan idle(0, 0, m_settings.GetIntValue(CSettings::SETTING_PVRPOWERMANAGEMENT_BACKENDIDLETIME), 0);
CDateTime wakeuptime;
/* Check next active time */
const std::shared_ptr<CPVRTimerInfoTag> timer = GetNextActiveTimer();
if (timer)
{
const CDateTimeSpan prestart(0, 0, timer->MarginStart(), 0);
const CDateTime start = timer->StartAsUTC();
wakeuptime = ((start - prestart - prewakeup - idle) > now) ?
start - prestart - prewakeup :
now + idle;
}
/* check daily wake up */
if (dailywakup)
{
CDateTime dailywakeuptime;
dailywakeuptime.SetFromDBTime(m_settings.GetStringValue(CSettings::SETTING_PVRPOWERMANAGEMENT_DAILYWAKEUPTIME));
dailywakeuptime = dailywakeuptime.GetAsUTCDateTime();
dailywakeuptime.SetDateTime(
now.GetYear(), now.GetMonth(), now.GetDay(),
dailywakeuptime.GetHour(), dailywakeuptime.GetMinute(), dailywakeuptime.GetSecond()
);
if ((dailywakeuptime - idle) < now)
{
const CDateTimeSpan oneDay(1,0,0,0);
dailywakeuptime += oneDay;
}
if (!wakeuptime.IsValid() || dailywakeuptime < wakeuptime)
wakeuptime = dailywakeuptime;
}
const CDateTime retVal(wakeuptime);
return retVal;
}
示例6: GetNextEventTime
CDateTime CPVRTimers::GetNextEventTime(void) const
{
const bool dailywakup = CSettings::Get().GetBool("pvrpowermanagement.dailywakeup");
const CDateTime now = CDateTime::GetUTCDateTime();
const CDateTimeSpan prewakeup(0, 0, CSettings::Get().GetInt("pvrpowermanagement.prewakeup"), 0);
const CDateTimeSpan idle(0, 0, CSettings::Get().GetInt("pvrpowermanagement.backendidletime"), 0);
CDateTime wakeuptime;
/* Check next active time */
CFileItemPtr item = GetNextActiveTimer();
if (item && item->HasPVRTimerInfoTag())
{
const CDateTimeSpan prestart(0, 0, item->GetPVRTimerInfoTag()->MarginStart(), 0);
const CDateTime start = item->GetPVRTimerInfoTag()->StartAsUTC();
wakeuptime = ((start - prestart - prewakeup - idle) > now) ?
start - prestart - prewakeup :
now + idle;
}
/* check daily wake up */
if (dailywakup)
{
CDateTime dailywakeuptime;
dailywakeuptime.SetFromDBTime(CSettings::Get().GetString("pvrpowermanagement.dailywakeuptime"));
dailywakeuptime = dailywakeuptime.GetAsUTCDateTime();
dailywakeuptime.SetDateTime(
now.GetYear(), now.GetMonth(), now.GetDay(),
dailywakeuptime.GetHour(), dailywakeuptime.GetMinute(), dailywakeuptime.GetSecond()
);
if ((dailywakeuptime - idle) < now)
{
const CDateTimeSpan oneDay(1,0,0,0);
dailywakeuptime += oneDay;
}
if (!wakeuptime.IsValid() || dailywakeuptime < wakeuptime)
wakeuptime = dailywakeuptime;
}
const CDateTime retVal(wakeuptime);
return retVal;
}