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


C++ CTime::GetDayOfWeek方法代码示例

本文整理汇总了C++中CTime::GetDayOfWeek方法的典型用法代码示例。如果您正苦于以下问题:C++ CTime::GetDayOfWeek方法的具体用法?C++ CTime::GetDayOfWeek怎么用?C++ CTime::GetDayOfWeek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTime的用法示例。


在下文中一共展示了CTime::GetDayOfWeek方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetPreDate

long CHSDownloadData::GetPreDate( long lCurrentDate,int nDays,int nPeriodType )
{
	int nCount = 0;
	CTimeSpan tmOneDay(1,0,0,0);
	CTime tm = GetTimeFromIntTime(lCurrentDate,nPeriodType);
	while(nCount < nDays )
	{
		tm -= tmOneDay;
		if (tm.GetDayOfWeek() != 1 && tm.GetDayOfWeek() != 7 )
		{
			nCount ++;
		}
	}
	return GetIntTimeFromTime(tm,nPeriodType);
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:15,代码来源:HSDownloadData.cpp

示例2: ShowWindow

void CConfigRecord::ShowWindow(int nChannel)
{	
	m_ctlRedundancy.SetCheck(m_RecordCfg.vRecordConfigAll[nChannel].bRedundancy);
	SetDlgItemInt(IDC_EDIT_PRERECLEN,m_RecordCfg.vRecordConfigAll[nChannel].iPreRecord);
	SetDlgItemInt(IDC_EDIT_RECORDLEN,m_RecordCfg.vRecordConfigAll[nChannel].iPacketLength);
	if ((m_RecordCfg.vRecordConfigAll[nChannel].iRecordMode == 1) || (m_RecordCfg.vRecordConfigAll[nChannel].iRecordMode == 0))
	{
		if (m_RecordCfg.vRecordConfigAll[nChannel].iRecordMode == 1)
		{
			CheckRadioButton(IDC_RADIO0,IDC_RADIO2,IDC_RADIO1);
		}else
		{
			CheckRadioButton(IDC_RADIO0,IDC_RADIO2,IDC_RADIO2);
		}
		ShowTime(FALSE);
	}else
	{
		CheckRadioButton(IDC_RADIO0,IDC_RADIO2,IDC_RADIO0);
		ShowTime(TRUE);
	}
	//ShowTime(FALSE);
	CTime time = CTime::GetCurrentTime();
	m_ctlRecordWeek.SetCurSel(time.GetDayOfWeek()-1);
	m_nLastWeek = 0;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例3: GetWorkDays

long GetWorkDays(long lBeginDate,long lEndDate,BOOL bCountHeadTail=TRUE)
{
	long lDays = 0;
	if (lBeginDate <= 0 || lEndDate <= 0)
		return -1;

	CTimeSpan tOneDay(1,0,0,0);
	CTime tBeginDate = LongToDate(lBeginDate);
	CTime tEndDate = LongToDate(lEndDate);

	if (tBeginDate > tEndDate)
		return -1;

	if (!bCountHeadTail)
	{
		tBeginDate += tOneDay;
		tEndDate -= tOneDay;
	}

	if (tBeginDate > tEndDate)
		return - 1;

	while( tBeginDate <= tEndDate)
	{
		long lWeekend = tBeginDate.GetDayOfWeek();
		tBeginDate += tOneDay;
		if (lWeekend == 1 || lWeekend == 7)
		{
			continue;
		}
		lDays++;		
	};

	return lDays;
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:35,代码来源:HSDownloadData.cpp

示例4: OnBnClickedStartQuery

void CDlgFilterPanel::OnBnClickedStartQuery()
{
	// Get CTime from 1st DataTime Control on the dialog
	CTime SelTime;
	this->m_CtrlDataTime.GetTime(SelTime);

	// Get CTime from 2nd DataTime Control on the dialog
	CTime SaleWk1;
	this->m_CtrlDateTime2.GetTime(SaleWk1);

	// Check user select date, must be Monday
	if ( (SelTime.GetDayOfWeek() != 2) || (SaleWk1.GetDayOfWeek() != 2) )
	{
		::MessageBox(NULL,
			"Sorry, you selected date is not Monday.\nPlease try again.",
			"Warning", MB_OK | MB_ICONWARNING);
		return;
	}

	LPMAINWORKTHREADPARAM lpThreadParam = new MAINWORKTHREADPARAM;
	lpThreadParam->_StartingDate = SelTime.GetTime();
	lpThreadParam->_FirstWeekSale = SaleWk1.GetTime();
	CWinThread *pWinThread = AfxBeginThread(
		(AFX_THREADPROC) MainWorkThreadFunc, (LPVOID) lpThreadParam,
		THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
	pWinThread->m_bAutoDelete = TRUE;
	pWinThread->ResumeThread();

	OnOK();
}
开发者ID:liyue80,项目名称:bpmps,代码行数:30,代码来源:DlgFilterPanel.cpp

示例5: TickTimerHappyHour

void cHappyHour::TickTimerHappyHour()
{
	if (HappyHourEnabled == 0) return;
	CTime t = CTime::GetCurrentTime();
	int Hour = t.GetHour();
	int Min = t.GetMinute();
	int WeekDay = t.GetDayOfWeek();
	
	if (!t.GetSecond())
	{
		for (int i=0; i<HappyHoursNumber; i++)
		{
			if (Hour == HappyStruct[i].S_Hour && Min == HappyStruct[i].S_Min && (WeekDay == HappyStruct[i].S_WeekDay || HappyStruct[i].S_WeekDay == -1))
			{
				Chat.MessageAll(0,0,NULL,"[Happy Hour] %s Event Started. Event Close in %d:%02d.",
					Utilits.GetMapName(HappyStruct[i].MapNum),HappyStruct[i].C_Hour,HappyStruct[i].C_Min);
				HappyStruct[i].Started = true;
			}

			if  (Hour == HappyStruct[i].C_Hour && Min == HappyStruct[i].C_Min && (WeekDay == HappyStruct[i].C_WeekDay || HappyStruct[i].C_WeekDay == -1))
			{
				Chat.MessageAll(0,0,NULL,"[Happy Hour] On %s Event Close.",Utilits.GetMapName(HappyStruct[i].MapNum));	
				HappyStruct[i].Started = false;
			}
			CheckNeedMessage(i);
		}
	}
}
开发者ID:Banerus,项目名称:ImaginationArts-Julia-Addon,代码行数:28,代码来源:HappyHour.cpp

示例6: OnBnClickedUpdateLweek

void CRecordUpDlg::OnBnClickedUpdateLweek()
{
	// TODO: 在此添加控件通知处理程序代码
	UpdateData(TRUE);

	m_radio = 2;

	CTime ct = CTime::GetCurrentTime();
	// 调时间         日  小时 分钟 秒
	ct -= CTimeSpan(ct.GetDayOfWeek()-1, 0, 0, 0);
	int m_ny = ct.GetYear();
	int m_nm = ct.GetMonth();
	int m_nd = ct.GetDay();
	ct -= CTimeSpan(7, 0, 0, 0);
	int m_fy = ct.GetYear();
	int m_fm = ct.GetMonth();
	int m_fd = ct.GetDay();

	CString ft, nt, cs;
	ft.Format(_T("'%d-%d-%d'"), m_fy, m_fm, m_fd);
	nt.Format(_T("'%d-%d-%d'"), m_ny, m_nm, m_nd);

	cs = _T("upTime between ");
	cs += ft;
	cs += _T(" and ");
	cs += nt;
	//MessageBox(cs);
	set.m_strFilter = cs;
	ListTheInfo();
}
开发者ID:ZhengzhenZhang,项目名称:course-design,代码行数:30,代码来源:RecordUpDlg.cpp

示例7: CheckNeedMessage

void cHappyHour::CheckNeedMessage(int i)
{
	CTime t = CTime::GetCurrentTime();
	int Hour = t.GetHour();
	int Min = t.GetMinute();
	int WeekDay = t.GetDayOfWeek();

	for (int j = 0; j < MessageTimeBeforeCount; j++)
	{
		int TempMin = HappyStruct[i].S_Min - MessageTimeBefore[j];
		int TempHour = HappyStruct[i].S_Hour;
		int TempWeekday = HappyStruct[i].S_WeekDay;

		while(TempMin < 0)
		{
			TempMin += 60;
			TempHour --;
		}

		while(TempHour < 0)
		{
			TempHour += 24;
			TempWeekday --;
			if(TempWeekday == 0)
				TempWeekday = 7;
		}

		if(Hour == TempHour && Min == TempMin && WeekDay == TempWeekday)
			Chat.MessageAll(0,0,NULL,"[Happy Hour] %s will start in %d min.", Utilits.GetMapName(HappyStruct[i].MapNum), MessageTimeBefore[j]);	
	}

	for (int l = 0; l < MessageTimeAfterCount; l++)
	{
		if(HappyStruct[i].Started == false)
			continue;

		int TempMin = HappyStruct[i].C_Min - MessageTimeBefore[l];
		int TempHour = HappyStruct[i].C_Hour;
		int TempWeekday = HappyStruct[i].C_WeekDay;

		while(TempMin < 0)
		{
			TempMin += 60;
			TempHour --;
		}

		while(TempHour < 0)
		{
			TempHour += 24;
			TempWeekday --;
			if(TempWeekday == 0)
				TempWeekday = 7;
		}

		if(Hour == TempHour && Min == TempMin && WeekDay == TempWeekday)
			Chat.MessageAll(0,0,NULL,"[Happy Hour] %s will end in %d min.", Utilits.GetMapName(HappyStruct[i].MapNum), MessageTimeBefore[l]);	
	}
}
开发者ID:Banerus,项目名称:ImaginationArts-Julia-Addon,代码行数:58,代码来源:HappyHour.cpp

示例8: OnDTNotify

void CTaiChuQuanSetDlg::OnDTNotify(NMHDR *pHdr, LRESULT * pRes)
{
	if(m_fromWhich == 1)//
	{
		CTaiShanDoc* pDoc=CMainFrame::m_taiShanDoc; 

		if(pView == NULL)return;

		CTime tm;
		m_DateTime .GetTime(tm);
		int nDy = tm.GetDayOfWeek ();
		if(nDy == 1|| nDy ==7)
		{
			this->GetDlgItem(IDC_STATIC_STATUS)->SetWindowText("所选日期是星期六或星期天,请重新选择!");
		}
		else
			this->GetDlgItem(IDC_STATIC_STATUS)->SetWindowText("");
		int nFinded=-1;
		int nYear=tm.GetYear ();
		int nMon=tm.GetMonth  ();
		int nDay=tm.GetDay  ();
		CTime tmB(1970,1,1,8,0,0);
		for(int i=0;i<pView->pKlineDrawing ->m_PowerArray .GetSize();i++)
		{
			CTime tmEnd=tmB+pView->pKlineDrawing ->m_PowerArray[i].nTime;
			if(tmEnd.GetDay()==nDay&&tmEnd.GetMonth()==nMon&&tmEnd.GetYear()==nYear)
			{
				 m_timet=pView->pKlineDrawing ->m_PowerArray[i].nTime;
				 m_fAlloc=pView->pKlineDrawing ->m_PowerArray[i].fAllocate*10;
				 m_fDivid=pView->pKlineDrawing ->m_PowerArray[i].fDividend*10;
				 m_fPrice=pView->pKlineDrawing ->m_PowerArray[i].fAllocatePrice;
				 m_fGive=pView->pKlineDrawing ->m_PowerArray[i].fGive*10;
				 m_kind=pView->pKlineDrawing ->m_PowerArray[i].nFlags;
				if( m_kind<0 || m_kind>2)
					 m_kind=0;
				nFinded=i;
				break;
			}
		}
		if(nFinded<0)
		{
			m_fAlloc =0.0f;
			m_fDivid =0.0f;
			m_fPrice =0.0f;
			m_fGive  =0.0f;
			m_kind = 0;
		}
		UpdateData(FALSE);
	}
}
开发者ID:ifzz,项目名称:yinhustock,代码行数:50,代码来源:CTaiChuQuanSetDlg.cpp

示例9: GetItemDayOfWeek

int CDataFactory::GetItemDayOfWeek(DWORD dwDataIndex)
{
	ASSERT(!m_bIsCurData);	// 必须是初始数据
	
	LPDATAITEM lpDataItem = _GetDataItem(dwDataIndex);
	if(lpDataItem == NULL)
	{
		return 0;
	}
	
	DWORD dwDateTime = lpDataItem->dwDataTime;
	
	CTime tmDateTime = CTime(2000 + dwDateTime / 100000000, (dwDateTime / 1000000) % 100, (dwDateTime / 10000) % 100, 0, 0, 0);
    
	return tmDateTime.GetDayOfWeek() - 1;
}
开发者ID:haha2500,项目名称:QCLottery,代码行数:16,代码来源:DataFactory.cpp

示例10: GetDayOfWeekFlag

WORD CScheduledTask::GetDayOfWeekFlag ( const CTime& time ) const
{
static WORD s_wDayFlags[] = { 0, TASK_SUNDAY, TASK_MONDAY, TASK_TUESDAY,
                              TASK_WEDNESDAY, TASK_THURSDAY, TASK_FRIDAY,
                              TASK_SATURDAY };
WORD wRet = 0;
int  nDayOfWeek = time.GetDayOfWeek();

    ASSERT ( nDayOfWeek >= 1  &&  nDayOfWeek <= 7 );

    wRet = s_wDayFlags [ nDayOfWeek ];

    ASSERT ( wRet != 0 );

    return wRet;
}
开发者ID:DjPasco,项目名称:Mag,代码行数:16,代码来源:ScheduledTask.cpp

示例11: OnLoad

void CXfilterDlg::OnLoad() 
{
	IpFilterDriver.init(IP_FILTER_DRIVER_NAME, FILE_ATTRIBUTE_NORMAL);	
	CString s;
	CTime time = CTime::GetCurrentTime();
	CTimeSpan ts;
	CTime t(0);
	ts = time - t;
	s.Format("CurrentTime: %u, %s DayCount:%u, TotalSec:%u, Week: %u\n"
		, CTime::GetCurrentTime().GetTime()
		, time.Format("%Y-%m-%d %H:%M:%S")
		, ts.GetDays()
		, ts.GetTotalSeconds()
		, time.GetDayOfWeek());
//	OutputDebugString(s);

	if (IpFilterDriver.getError() != NO_ERROR) 
		AfxMessageBox(_T("Can't load IpFilter Driver"));
}
开发者ID:340211173,项目名称:hf-2011,代码行数:19,代码来源:xfilterDlg.cpp

示例12: SetWeekly

void CScheduler::SetWeekly(int action,bool activate)
{
	bool Currentactivated = HasWeekly(action);
    if (  Currentactivated == activate) 
		 return; // nothing to do. 

	if ( ( Currentactivated == false )&& (activate == true)) { // must we insert a new? 
     	Schedule_Struct* newschedule=new Schedule_Struct();
		struct tm tmTemp;
	    CTime tNow = CTime(safe_mktime(CTime::GetCurrentTime().GetLocalTm(&tmTemp)));
	
	    newschedule->day=tNow.GetDayOfWeek();
	    newschedule->enabled=true;
	    newschedule->time=time(NULL);
	    newschedule->time2=time(NULL);
	    newschedule->title=GetResString(IDS_SCHEDTEXT);
	    newschedule->ResetActions();
		newschedule->actions[0]=action;
		newschedule->values[0]=L"update";
		AddSchedule(newschedule);
		thePrefs.scheduler=true; // enable scheduler
	}
	if ((Currentactivated == true )&& (activate == false)) { // we must delete

		Schedule_Struct* curschedule;
		for (uint8 si=0;si< GetCount();si++) {
			curschedule=  GetSchedule(si);
			if (curschedule->actions[0]==0 || !curschedule->enabled) continue;
			if (curschedule->day!=DAY_DAYLY) { // not daily, so must be weekly ( or montly, good also) 
				for (int ai=0;ai<16;ai++) {
					if (curschedule->actions[ai]==action) {
						RemoveSchedule(si);
						return ;
					}
				}
			}
		}
		// not found? then schedule does not exist. ASSERT()?;
		return ;
	}
};
开发者ID:brolee,项目名称:EMule-GIFC,代码行数:41,代码来源:Scheduler.cpp

示例13: UpdateGameStatus

void CMonitorPage::UpdateGameStatus(const i8desk::GameInfoMap& GameInfos)
{
	int nIdcCount = 0, nSvrCount = 0, nMatchCount = 0;
	int nAutoUptCount = 0, nNeedUptCount = 0;
	int nIdcAddInThisWeekCount = 0, nIdcUpdateCount = 0;
	int nIdcI8PlayCount = 0, nIdcI8PlayNotDownloadCount = 0;
	unsigned __int64 ullIdcSize = 0, ullSvrSize = 0;
	unsigned __int64 ullIdcI8PlaySize = 0, ullIdcI8PlayNotDownloadSize = 0;
	
	int nAddGameNoDownNum = 0; //近期新增资源(未下载)

	int nConVirRunGameNum = 0;	//配置为虚拟盘运行的资源数
	unsigned __int64 ullConVirRunGameSize = 0;

	int nConLocRunGameNum = 0;	//配置为本地更新运行的资源数
	unsigned __int64 ullConLocRunGameSize = 0;	

	int nConRunNotUptGameNum = 0;//配置为不更新,直接运行的资源数
	unsigned __int64 ullConRunNotUptGameSize = 0;

	CTime now = CTime::GetCurrentTime();
	int nowYear = now.GetYear();
	int nowMonth = now.GetMonth();
	int nowDay = now.GetDay();

	CTime start(now.GetYear(), now.GetMonth(), now.GetDay(), 0, 0, 0);
	start -= CTimeSpan(30,0,0,0); //30天算近期
	DWORD StartTime = (DWORD)start.GetTime();

	//得到本周开始的时刻,用于计算本周中心更新的游戏数
	int nowDayOfWeek = now.GetDayOfWeek();
	CTime ThisWeekStart = now - CTimeSpan(nowDayOfWeek);

	CTime ThisWeekStartDay(ThisWeekStart.GetYear(), 
		ThisWeekStart.GetMonth(), ThisWeekStart.GetDay(), 0, 0, 0);
	DWORD ThisWeekStartTime = (DWORD)ThisWeekStartDay.GetTime();

	i8desk::GameInfoMapCItr it = GameInfos.begin();
	for (; it != GameInfos.end(); ++it) 
	{
		if (it->second->GID >= MIN_IDC_GID) 
		{
			nIdcCount++;
			ullIdcSize += it->second->Size;

			if (it->second->Status == 1)
				nMatchCount++;

			if (it->second->AddDate > StartTime && it->second->Status == 0)
			{
				nAddGameNoDownNum++;
			}

			if (it->second->IdcVer > ThisWeekStartTime)
			{
				nIdcAddInThisWeekCount++;

				CTime IdcUpdateTime = it->second->IdcVer;
				if (IdcUpdateTime.GetDay() == nowDay
					&& IdcUpdateTime.GetMonth() == nowMonth
					&& IdcUpdateTime.GetYear() == nowYear)
				{
					nIdcUpdateCount++;
				}
			}

			if (it->second->I8Play == 1)
			{
				nIdcI8PlayCount++;
				ullIdcI8PlaySize += it->second->Size;

				if (it->second->Status == 0) 
				{
					nIdcI8PlayNotDownloadCount++;
					ullIdcI8PlayNotDownloadSize += it->second->Size;
				}
			}
		}

		if (it->second->Status == 1)
		{
			nSvrCount++;
			ullSvrSize += it->second->Size;

			if (it->second->AutoUpt == 1)
				nAutoUptCount++;
			if (it->second->GID >= MIN_IDC_GID 
				&& it->second->IdcVer != it->second->SvrVer)
				nNeedUptCount++;

			bool bConLocRunGame = false;
			bool bConVirRunGame = false;
			bool bConRunNotUptGame = false;

			for (size_t i = 0; i < it->second->RunTypes.size(); i++)
			{
				switch (it->second->RunTypes[i].RunType)
				{
				case ERT_LOCAL: 
					bConLocRunGame = true; 
//.........这里部分代码省略.........
开发者ID:lubing521,项目名称:important-files,代码行数:101,代码来源:monitorpage.cpp

示例14: Load

void CFoodMenuDlg::Load( BOOL bByOtherWnd) 
{
	int i = 0;
	// TODO: Add your control notification handler code here
	CTime iDT =  CTime::GetCurrentTime();						
		
	int nCurDay = iDT.GetDayOfWeek();	// 1 = Sunday, 2 = Monday, ..., 7 = Saturday
		
	if(nCurDay == 2)
	{
		//월요일		
	}
	else if(nCurDay == 3)
	{
		// 화요일
		iDT -= CTimeSpan(1, 0, 0, 0); 
	}
	else if(nCurDay == 4)
	{
		//수요일
		iDT -= CTimeSpan(2, 0, 0, 0); 
	}
	else if(nCurDay == 5)
	{
		//목
		iDT -= CTimeSpan(3, 0, 0, 0); 
	}
	else if(nCurDay == 6)
	{
		//금
		iDT -= CTimeSpan(4, 0, 0, 0); 
	}				
	
	//CString strFirstDayOfWeek = iDT.Format("%Y%m%d%H%M%S")	;
	if(!bByOtherWnd)
	{
		COleDateTime tmpOleTmDate;
		tmpOleTmDate.SetDate( atoi( (LPCSTR) iDT.Format("%Y")) , atoi( (LPCSTR) iDT.Format("%m")) , atoi( (LPCSTR) iDT.Format("%d") ));
		m_FoodMenuDateCtrl.SetTime(tmpOleTmDate);

		SetDateLabel() ;			
	}

	m_strMonDayOfWeek = iDT.Format("%Y%m%d")	;

	CString strFileName;
	char szWinDir[512];		
	char szDirTmp[512];
	char szDir[1024];

	memset(szWinDir, 0x00, sizeof(szWinDir));		
	memset(szDirTmp, 0x00, sizeof(szDirTmp));	
	memset(szDir, 0x00, sizeof(szDir));	

	GetWindowsDirectory(szWinDir, sizeof(szWinDir));	
	GetModuleFileName ( GetModuleHandle(IDMS_MSN_SVR_NAME), szDirTmp, sizeof(szDirTmp));	
	int nPos = 0;
	int nLen = strlen(szDirTmp);
	for( i = nLen; i>=0 ; i--)
	{
		if(szDirTmp[i] == '\\' && nPos <1 )
		{
			szDirTmp[i] = '\0';
			nPos++;
			break;
		}
	}
	
	strcat( szDirTmp, "\\food_menu\\" );

	if (_access( (LPCSTR)szDirTmp ,0) ==-1 ) 
	{
		CreateDirectory((LPCSTR)szDirTmp, NULL);		
	}
	
	m_strFileNameAll.Format("%s\\%s_FoodMenu.txt", szDirTmp ,m_strMonDayOfWeek );	

	TRACE("%s\n" , m_strFileNameAll);

	if (_access( (LPCSTR)m_strFileNameAll ,0) ==-1 ) 
	{
		return ;
	}

	CStdioFile fCmdDat(
						m_strFileNameAll,	CFile::modeNoTruncate | CFile::modeReadWrite | CFile::typeText | 
									CFile::shareDenyNone
					  );	
	
	CString rString = "";		

	//if( fCmdDat.ReadString(rString) )
	
	fCmdDat.ReadString(rString) ;
	
	if(rString.IsEmpty())
	{
		return;
	}

//.........这里部分代码省略.........
开发者ID:jeremyko,项目名称:IDMS_Messenger,代码行数:101,代码来源:FoodMenuDlg.cpp

示例15: Check

int CScheduler::Check(bool forcecheck){
	if (!thePrefs.IsSchedulerEnabled()
		|| theApp.scheduler->GetCount()==0
		|| !theApp.emuledlg->IsRunning()) return -1;

	Schedule_Struct* schedule;
	struct tm tmTemp;
	CTime tNow = CTime(safe_mktime(CTime::GetCurrentTime().GetLocalTm(&tmTemp)));
	
	if (!forcecheck && tNow.GetMinute()==m_iLastCheckedMinute) return -1;

	m_iLastCheckedMinute=tNow.GetMinute();
	theApp.scheduler->RestoreOriginals();

	for (uint8 si=0;si<theApp.scheduler->GetCount();si++) {
		schedule=theApp.scheduler->GetSchedule(si);
		if (schedule->actions[0]==0 || !schedule->enabled) continue;

		// check day of week
		if (schedule->day!=DAY_DAYLY) {
			int dow=tNow.GetDayOfWeek();
			switch (schedule->day) {
				case DAY_MO : if (dow!=2) continue;
					break;
				case DAY_DI : if (dow!=3) continue;
					break;
				case DAY_MI : if (dow!=4) continue;
					break;
				case DAY_DO : if (dow!=5) continue;
					break;
				case DAY_FR : if (dow!=6) continue;
					break;
				case DAY_SA : if (dow!=7) continue;
					break;
				case DAY_SO : if (dow!=1) continue;
					break;
				case DAY_MO_FR : if (dow==7 || dow==1 ) continue;
					break;
				case DAY_MO_SA : if (dow==1) continue;
					break;
				case DAY_SA_SO : if (dow>=2 && dow<=6) continue;
			}
		}

		//check time
		UINT h1,h2,m1,m2;
		CTime t1=CTime(schedule->time);
		CTime t2=CTime(schedule->time2);
		h1=t1.GetHour();	h2=t2.GetHour();
		m1=t1.GetMinute();	m2=t2.GetMinute();
		int it1,it2, itn;
		it1=h1*60 + m1;
		it2=h2*60 + m2;
		itn=tNow.GetHour()*60 + tNow.GetMinute();
		if (it1<=it2) { // normal timespan
			if ( !(itn>=it1 && itn<it2) ) continue;
		} else {		   // reversed timespan (23:30 to 5:10)  now 10
			if ( !(itn>=it1 || itn<it2)) continue;
		}

		// ok, lets do the actions of this schedule
		ActivateSchedule(si,schedule->time2==0);
	}

	return -1;
}
开发者ID:SomeSupport,项目名称:eMule,代码行数:66,代码来源:Scheduler.cpp


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