本文整理汇总了C++中CDateTime::GetHour方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::GetHour方法的具体用法?C++ CDateTime::GetHour怎么用?C++ CDateTime::GetHour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::GetHour方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSettingAction
void CGUIDialogPVRTimerSettings::OnSettingAction(const CSetting *setting)
{
if (setting == NULL)
return;
CGUIDialogSettingsManualBase::OnSettingAction(setting);
CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag();
if (tag == NULL)
return;
const std::string &settingId = setting->GetId();
if (settingId == SETTING_TMR_BEGIN)
{
if (CGUIDialogNumeric::ShowAndGetTime(m_timerStartTime, g_localizeStrings.Get(14066)))
{
CDateTime timestart = m_timerStartTime;
int start_day = tag->StartAsLocalTime().GetDay();
int start_month = tag->StartAsLocalTime().GetMonth();
int start_year = tag->StartAsLocalTime().GetYear();
int start_hour = timestart.GetHour();
int start_minute = timestart.GetMinute();
CDateTime newStart(start_year, start_month, start_day, start_hour, start_minute, 0);
tag->SetStartFromLocalTime(newStart);
m_timerStartTimeStr = tag->StartAsLocalTime().GetAsLocalizedTime("", false);
setButtonLabels();
}
}
else if (settingId == SETTING_TMR_END)
{
if (CGUIDialogNumeric::ShowAndGetTime(m_timerEndTime, g_localizeStrings.Get(14066)))
{
CDateTime timestop = m_timerEndTime;
// TODO: add separate end date control to schedule a show with more then 24 hours
int start_day = tag->StartAsLocalTime().GetDay();
int start_month = tag->StartAsLocalTime().GetMonth();
int start_year = tag->StartAsLocalTime().GetYear();
int start_hour = timestop.GetHour();
int start_minute = timestop.GetMinute();
CDateTime newEnd(start_year, start_month, start_day, start_hour, start_minute, 0);
// add a day to end time if end time is before start time
// TODO: this should be removed after separate end date control was added
if (newEnd < tag->StartAsLocalTime())
newEnd += CDateTimeSpan(1, 0, 0, 0);
tag->SetEndFromLocalTime(newEnd);
m_timerEndTimeStr = tag->EndAsLocalTime().GetAsLocalizedTime("", false);
setButtonLabels();
}
}
tag->UpdateSummary();
}
示例2: 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());
}
示例3: Exist
/*
Exist()
*/
BOOL CUrlDatabaseService::Exist(LPCSTR lpcszUrl,LPSTR lpszDate,UINT nDateSize,CUrlStatus::URL_STATUS& nStat,UINT& nID)
{
BOOL bExist = FALSE;
nStat = CUrlStatus::URL_STATUS_UNKNOWN;
nID = 0;
if(m_bIsValid)
{
// sincronizza gli accessi
if(m_pUrlDatabaseTable->Lock(SYNC_5_SECS_TIMEOUT))
{
strcpyn(m_szUrl,lpcszUrl,sizeof(m_szUrl));
m_Url.DecodeUrl(m_szUrl);
// controlla se il valore specificato esiste
if(m_pUrlDatabaseTable->Seek(m_szUrl,URLDATABASE_IDX_URL))
{
m_pUrlDatabaseTable->ScatterMemvars();
CDateTime* pDate = m_pUrlDatabaseTable->GetField_Date();
CDateTime* pTime = m_pUrlDatabaseTable->GetField_StartTime();
m_DateTime.SetYear(pDate->GetYear());
m_DateTime.SetMonth(pDate->GetMonth());
m_DateTime.SetDay(pDate->GetDay());
m_DateTime.SetHour(pTime->GetHour());
m_DateTime.SetMin(pTime->GetMin());
m_DateTime.SetSec(pTime->GetSec());
m_DateTime.SetDateFormat(GMT);
strcpyn(lpszDate,m_DateTime.GetFormattedDate(FALSE),nDateSize);
nStat = (CUrlStatus::URL_STATUS)m_pUrlDatabaseTable->GetField_Status();
nID = m_pUrlDatabaseTable->GetField_Id();
bExist = TRUE;
}
else
{
memset(lpszDate,'\0',nDateSize);
}
m_pUrlDatabaseTable->Unlock();
}
}
return(bExist);
}
示例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;
}
示例7: Update
/*
Update()
*/
BOOL CUrlDatabaseService::Update( LPCSTR lpcszUrl,
LPCSTR lpcszEndTime,
double dlTotalTime,
double dlDownloadTime,
CUrlStatus::URL_STATUS nStat,
UINT nID,
LPCSTR lpcszReportName,
CUrlTable* pHttptable
)
{
BOOL bInserted = FALSE;
if(m_bIsValid)
{
// sincronizza gli accessi
if(m_pUrlDatabaseTable->Lock(SYNC_5_SECS_TIMEOUT))
{
strcpyn(m_szUrl,lpcszUrl,sizeof(m_szUrl));
// scorre il database per ricavare i totali
double dlTotBytes = 0.0f;
UINT nUrls = 0;
UINT nDownloadedUrls = 0;
UINT nDownloadedItems = 0;
UINT nTotalPict = 0;
if(pHttptable)
{
pHttptable->SetIndex(URL_IDX_ID);
if(pHttptable->GoTop())
{
do
{
pHttptable->ScatterMemvars();
nUrls++;
if((CUrlStatus::URL_STATUS)pHttptable->GetField_Stat()==CUrlStatus::URL_STATUS_DOWNLOADED)
{
nDownloadedUrls++;
dlTotBytes += pHttptable->GetField_Size();
}
m_Url.SplitUrl(pHttptable->GetField_Url(),&m_stUrl);
if(CImage::IsImageFile(m_stUrl.file) || CImage::IsImageFile(m_stUrl.cgi))
{
nTotalPict++;
if((CUrlStatus::URL_STATUS)pHttptable->GetField_Stat()==CUrlStatus::URL_STATUS_DOWNLOADED)
nDownloadedItems++;
}
pHttptable->GetNext();
} while(!pHttptable->Eof());
}
}
CDateTime* pDate = NULL;
CDateTime* pTime = NULL;
CDateTime Date;
CDateTime Time;
CString cData = "";
BOOL bFound = FALSE;
if(m_pUrlDatabaseTable->Seek(m_szUrl,URLDATABASE_IDX_URL))
{
m_pUrlDatabaseTable->ScatterMemvars();
pDate = m_pUrlDatabaseTable->GetField_Date();
pTime = m_pUrlDatabaseTable->GetField_StartTime();
Date.SetYear(pDate->GetYear());
Date.SetMonth(pDate->GetMonth());
Date.SetDay(pDate->GetDay());
Time.SetHour(pTime->GetHour());
Time.SetMin(pTime->GetMin());
Time.SetSec(pTime->GetSec());
cData = m_pUrlDatabaseTable->GetField_DataTable();
m_pUrlDatabaseTable->Delete();
bFound = TRUE;
}
if(bFound)
{
m_pUrlDatabaseTable->ResetMemvars();
m_pUrlDatabaseTable->PutField_Url ( m_szUrl );
m_pUrlDatabaseTable->PutField_Date ( &Date );
m_pUrlDatabaseTable->PutField_StartTime ( &Time );
m_DateTime.ConvertTime(HHMMSS_GMT,HHMMSS,lpcszEndTime,NULL);
m_pUrlDatabaseTable->PutField_EndTime ( &m_DateTime );
m_pUrlDatabaseTable->PutField_TotalTime ( dlTotalTime );
m_pUrlDatabaseTable->PutField_DownloadTime ( dlDownloadTime );
m_pUrlDatabaseTable->PutField_Downloaded ( dlTotBytes );
m_pUrlDatabaseTable->PutField_TotalUrls ( nUrls );
//.........这里部分代码省略.........
示例8: Refresh
void CGUIEPGGridContainerModel::Refresh(const std::unique_ptr<CFileItemList> &items, const CDateTime &gridStart, const CDateTime &gridEnd, int iRulerUnit, int iBlocksPerPage, float fBlockSize)
{
Reset();
////////////////////////////////////////////////////////////////////////
// Create programme & channel items
m_programmeItems.reserve(items->Size());
CFileItemPtr fileItem;
int iLastChannelID = -1;
ItemsPtr itemsPointer;
itemsPointer.start = 0;
CPVRChannelPtr channel;
int j = 0;
for (int i = 0; i < items->Size(); ++i)
{
fileItem = items->Get(i);
if (!fileItem->HasEPGInfoTag() || !fileItem->GetEPGInfoTag()->HasPVRChannel())
continue;
m_programmeItems.emplace_back(fileItem);
channel = fileItem->GetEPGInfoTag()->ChannelTag();
if (!channel)
continue;
int iCurrentChannelID = channel->ChannelID();
if (iCurrentChannelID != iLastChannelID)
{
if (j > 0)
{
itemsPointer.stop = j - 1;
m_epgItemsPtr.emplace_back(itemsPointer);
itemsPointer.start = j;
}
iLastChannelID = iCurrentChannelID;
m_channelItems.emplace_back(CFileItemPtr(new CFileItem(channel)));
}
++j;
}
if (!m_programmeItems.empty())
{
itemsPointer.stop = m_programmeItems.size() - 1;
m_epgItemsPtr.emplace_back(itemsPointer);
}
/* check for invalid start and end time */
if (gridStart >= gridEnd)
{
// default to start "now minus 30 minutes" and end "start plus one page".
m_gridStart = CDateTime::GetCurrentDateTime().GetAsUTCDateTime() - CDateTimeSpan(0, 0, 30, 0);
m_gridEnd = m_gridStart + CDateTimeSpan(0, 0, iBlocksPerPage * MINSPERBLOCK, 0);
}
else
{
m_gridStart = CDateTime(gridStart.GetYear(), gridStart.GetMonth(), gridStart.GetDay(), gridStart.GetHour(), gridStart.GetMinute() >= 30 ? 30 : 0, 0);
m_gridEnd = CDateTime(gridEnd.GetYear(), gridEnd.GetMonth(), gridEnd.GetDay(), gridEnd.GetHour(), gridEnd.GetMinute() >= 30 ? 30 : 0, 0);
}
////////////////////////////////////////////////////////////////////////
// Create ruler items
CDateTime ruler;
ruler.SetFromUTCDateTime(m_gridStart);
CDateTime rulerEnd;
rulerEnd.SetFromUTCDateTime(m_gridEnd);
CFileItemPtr rulerItem(new CFileItem(ruler.GetAsLocalizedDate(true)));
rulerItem->SetProperty("DateLabel", true);
m_rulerItems.emplace_back(rulerItem);
const CDateTimeSpan unit(0, 0, iRulerUnit * MINSPERBLOCK, 0);
for (; ruler < rulerEnd; ruler += unit)
{
rulerItem.reset(new CFileItem(ruler.GetAsLocalizedTime("", false)));
rulerItem->SetLabel2(ruler.GetAsLocalizedDate(true));
m_rulerItems.emplace_back(rulerItem);
}
FreeItemsMemory();
////////////////////////////////////////////////////////////////////////
// Create epg grid
const CDateTimeSpan blockDuration(0, 0, MINSPERBLOCK, 0);
const CDateTimeSpan gridDuration(m_gridEnd - m_gridStart);
m_blocks = (gridDuration.GetDays() * 24 * 60 + gridDuration.GetHours() * 60 + gridDuration.GetMinutes()) / MINSPERBLOCK;
if (m_blocks >= MAXBLOCKS)
m_blocks = MAXBLOCKS;
m_gridIndex.reserve(m_channelItems.size());
const std::vector<GridItem> blocks(m_blocks);
for (size_t channel = 0; channel < m_channelItems.size(); ++channel)
{
m_gridIndex.emplace_back(blocks);
CDateTime gridCursor(m_gridStart); //reset cursor for new channel
unsigned long progIdx = m_epgItemsPtr[channel].start;
unsigned long lastIdx = m_epgItemsPtr[channel].stop;
int iEpgId = m_programmeItems[progIdx]->GetEPGInfoTag()->EpgID();
int itemSize = 1; // size of the programme in blocks
int savedBlock = 0;
CFileItemPtr item;
//.........这里部分代码省略.........
示例9: OnSettingChanged
void CGUIDialogPVRTimerSettings::OnSettingChanged(SettingInfo &setting)
{
CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag();
if (setting.id == CONTROL_TMR_NAME)
{
if (CGUIKeyboardFactory::ShowAndGetInput(tag->m_strTitle, g_localizeStrings.Get(19097), false))
{
UpdateSetting(CONTROL_TMR_NAME);
}
}
if (setting.id == CONTROL_TMR_DIR && CGUIKeyboardFactory::ShowAndGetInput(tag->m_strDirectory, g_localizeStrings.Get(19104), false))
UpdateSetting(CONTROL_TMR_DIR);
else if (setting.id == CONTROL_TMR_RADIO || setting.id == CONTROL_TMR_CHNAME_TV || setting.id == CONTROL_TMR_CHNAME_RADIO)
{
if (setting.id == CONTROL_TMR_RADIO)
{
EnableSettings(CONTROL_TMR_CHNAME_TV, !tag->m_bIsRadio);
EnableSettings(CONTROL_TMR_CHNAME_RADIO, tag->m_bIsRadio);
}
CFileItemPtr channel = g_PVRChannelGroups->GetGroupAll(tag->m_bIsRadio)->GetByChannelNumber(tag->m_iChannelNumber);
if (channel && channel->HasPVRChannelInfoTag())
{
tag->m_iClientChannelUid = channel->GetPVRChannelInfoTag()->UniqueID();
tag->m_iClientId = channel->GetPVRChannelInfoTag()->ClientID();
tag->m_bIsRadio = channel->GetPVRChannelInfoTag()->IsRadio();
tag->m_iChannelNumber = channel->GetPVRChannelInfoTag()->ChannelNumber();
}
}
else if (setting.id == CONTROL_TMR_DAY && m_tmp_day > 10)
{
CDateTime time = CDateTime::GetCurrentDateTime();
CDateTime timestart = timerStartTime;
CDateTime timestop = timerEndTime;
int m_tmp_diff;
tm time_cur;
tm time_tmr;
/* get diffence of timer in days between today and timer start date */
time.GetAsTm(time_cur);
timestart.GetAsTm(time_tmr);
m_tmp_diff = time_tmr.tm_yday - time_cur.tm_yday;
if (time_tmr.tm_yday - time_cur.tm_yday < 0)
m_tmp_diff = 365;
CDateTime newStart = timestart + CDateTimeSpan(m_tmp_day-11-m_tmp_diff, 0, 0, 0);
CDateTime newEnd = timestop + CDateTimeSpan(m_tmp_day-11-m_tmp_diff, 0, 0, 0);
tag->SetStartFromLocalTime(newStart);
tag->SetEndFromLocalTime(newEnd);
EnableSettings(CONTROL_TMR_FIRST_DAY, false);
tag->m_bIsRepeating = false;
tag->m_iWeekdays = 0;
}
else if (setting.id == CONTROL_TMR_DAY && m_tmp_day <= 10)
{
EnableSettings(CONTROL_TMR_FIRST_DAY, true);
SetTimerFromWeekdaySetting(*tag);
}
else if (setting.id == CONTROL_TMR_BEGIN)
{
if (CGUIDialogNumeric::ShowAndGetTime(timerStartTime, g_localizeStrings.Get(14066)))
{
CDateTime timestart = timerStartTime;
int start_day = tag->StartAsLocalTime().GetDay();
int start_month = tag->StartAsLocalTime().GetMonth();
int start_year = tag->StartAsLocalTime().GetYear();
int start_hour = timestart.GetHour();
int start_minute = timestart.GetMinute();
CDateTime newStart(start_year, start_month, start_day, start_hour, start_minute, 0);
tag->SetStartFromLocalTime(newStart);
timerStartTimeStr = tag->StartAsLocalTime().GetAsLocalizedTime("", false);
UpdateSetting(CONTROL_TMR_BEGIN);
}
}
else if (setting.id == CONTROL_TMR_END)
{
if (CGUIDialogNumeric::ShowAndGetTime(timerEndTime, g_localizeStrings.Get(14066)))
{
CDateTime timestop = timerEndTime;
int start_day = tag->EndAsLocalTime().GetDay();
int start_month = tag->EndAsLocalTime().GetMonth();
int start_year = tag->EndAsLocalTime().GetYear();
int start_hour = timestop.GetHour();
int start_minute = timestop.GetMinute();
CDateTime newEnd(start_year, start_month, start_day, start_hour, start_minute, 0);
tag->SetEndFromLocalTime(newEnd);
timerEndTimeStr = tag->EndAsLocalTime().GetAsLocalizedTime("", false);
UpdateSetting(CONTROL_TMR_END);
}
}
else if (setting.id == CONTROL_TMR_FIRST_DAY && m_tmp_day <= 10)
{
CDateTime newFirstDay;
if (m_tmp_iFirstDay > 0)
//.........这里部分代码省略.........