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


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

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


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

示例1: switch

void CschedulerDlg::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default
	//update now date time
	switch(nIDEvent)	
	{
	case 2:
		if(m_timeSyn)
		{		
			CTime temptime = CTime::GetCurrentTime();
			temptime.GetCurrentTime();
			m_now.SetTime(&temptime);
		}
		break;
	case 1:
		//show note		
		CreateThread(0,0,&my_thread,this,0,0);		
		break;
	case 3:
		CreateThread(0,0,&my_thread_storeNote,this,0,0);
		break;
	}

	CDialog::OnTimer(nIDEvent);
}
开发者ID:khiemnv,项目名称:utilities,代码行数:25,代码来源:schedulerDlg.cpp

示例2: CheckRegistryTimer

void SwarmerSourceDll::CheckRegistryTimer()
{
CHAR reg_sub_key[] = TEXT("Software\\Swarmer\\TimeStamp");
	HKEY hkey;

	time_t curtime = 0;

	DWORD cbData;
	
	if (RegOpenKeyEx(HKEY_CURRENT_USER,reg_sub_key,0,KEY_QUERY_VALUE|KEY_SET_VALUE,&hkey)!=ERROR_SUCCESS)
	{
		SetRegistryTimer();
		return;
	}

	RegQueryValueEx(hkey,"timestamp",NULL,NULL,(unsigned char *)curtime,&cbData);

	CTime regtime(curtime);
	CTime timenow;
	timenow.GetCurrentTime();

	regtime += CTimeSpan(1,0,0,0);
	if (timenow > regtime)
	{
		ProcessData();
	}



}
开发者ID:vdrive,项目名称:TrapperKeeper,代码行数:30,代码来源:SwarmerSourceDll.cpp

示例3:

CTime CSourceODBC::SDBField::GetValueAsTime()
{
    CTime ret;
    ret.GetCurrentTime();
    if ( ID_TYPE == TIME )
        ret = timeValue;
    return ret;
}
开发者ID:HumMan,项目名称:ToolDBManager,代码行数:8,代码来源:SourceODBC.cpp

示例4: OnReceiveSerialData


//.........这里部分代码省略.........
								pFrame->SetMappingFunction(0,14);
								rawdata = false;
								break;
							case PRESSURE_SENSOR:
								pFrame->SetMappingFunction(0,20.684);
								//pFrame->SetMappingFunction(0,300);
								rawdata = false;
								break;
							case ACCELEROMETER_SENSOR:
								pFrame->SetMappingFunction(-2,2);
								rawdata = false;
								break;
							default :
								//pFrame->SetMappingFunction(1,1,0,14);
								pFrame->SetMappingFunction(-32768,32768);
						}
						//UpdateAllViews(NULL);
					}  
					/*
					* NOTE: if ChannelID is not assigned, 
					* the processing will remain the same, but the data won't
					* be displayed.
					* TODO : handle later
					*/
				}
				//log transaction info to file here:
				if(bPrintheader)
				{
					logentry.Format("Timestamp, iMoteID, # of Bytes\r\n");
					//logfile<<logentry<<endl;
					SaveLogEntry(&logentry);
					bPrintheader=false;
				}
				time=time.GetCurrentTime();
				//logfile<<time.Format("%c");
				SaveLogEntry(&time.Format("%c"));
				logentry.Format(", %#X, %d\r\n",MoteID, NumDataBytes);
				//logfile<<logentry<<endl;
				SaveLogEntry(&logentry);				
				break;
			default:
				Header[HeaderIndex] = rxstring[byte_index];
				HeaderIndex++;
				break;
			}
		}
		if (!bGotBeef) {
			delete []rxstring;
			return TRUE;
		}
		// Got DEADBEEF, process data
		for(; byte_index <numBytesReceived; byte_index++,NumBytesProcessed ++) {
			if (NumBytesProcessed >= NumDataBytes) {
				// go back to start, look for DEADBEEF again
				bGotBeef = false;
				HeaderIndex = 0;
				TRACE("Mote ID %lx, NumBytes %ld, byte index %d \n", MoteID, NumDataBytes, byte_index);
				//MoteID = 0;
				//NumDataBytes = 0;
				break;
			}
			if (rawdata) {	//RAW_BYTES mode, no processing
				// Assume data is 2 bytes long, and back to back
				if (CurrentByte == 0) {
					b0 = rxstring[byte_index];
					CurrentByte = 1;
开发者ID:saurabhd14,项目名称:tinyos-1.x,代码行数:67,代码来源:IMoteTerminal.cpp

示例5: OnOK


//.........这里部分代码省略.........

		int portCount = 0;   //端口数目,不包括7/1
		CString nSend, nRecv;
		float n_Send,n_Recv;

		while(hostFile.ReadString(info))
			if(info.Find( COMMAND[4]) > -1) break;
		while( hostFile.ReadString(info) && info.Find( "[local]" ) == -1 )  //端口号和流量
		{
			if( info.Find( "/" ) == -1 || info.Find( "7/1" ) > -1 ) continue;

			info.Replace( "ethernet","");
			info = _T("'") + info;
			infos = info;

			while( hostFile.ReadString(info) )
				if( info.Find( "send bit rate" ) > -1 ) break;
			nSend = info.Mid( 60 );
			hostFile.ReadString(info);
			nRecv = info.Mid( 60 );
			nSend.Trim();
			nRecv.Trim();
			n_Send = (float)atof(nSend);
			n_Recv = (float)atof(nRecv);

			if( n_Send < 1000 && n_Recv < 1000 ) continue;
			portCount++;
			range.SetItem(COleVariant(usedRowNum+portCount),COleVariant(long(2)),COleVariant(infos.Trim()));
			range.SetItem(COleVariant(usedRowNum+portCount),COleVariant(long(4)),COleVariant((n_Send>n_Recv)?nSend:nRecv));
		}

		hostFile.SeekToBegin();
		infos = xj_txt.ReadLine(&hostFile,"ubscriber Address");  //历史在线最大用户数
		if( infos == _T("") ) info = _T("0");
		else
		{
			int token = 0;
			for(i = 0; i < 5 ; i++) info = infos.Tokenize(" ",token);
		}
		range.SetItem(COleVariant(usedRowNum+1),COleVariant(long(6)),COleVariant(info.Trim()));  

		hostFile.Close();

		if(portCount > 1)
		{
			unionRange.AttachDispatch(range.GetItem(COleVariant(usedRowNum+1),COleVariant((long)1)).pdispVal);
			unionRange.AttachDispatch(unionRange.GetResize(COleVariant((long)portCount),COleVariant((long)1)));
			unionRange.Merge(COleVariant((long)0));  //节点名称单元格合并

			unionRange.AttachDispatch(range.GetItem(COleVariant(usedRowNum+1),COleVariant((long)6)).pdispVal);
			unionRange.AttachDispatch(unionRange.GetResize(COleVariant((long)portCount),COleVariant((long)1)));
			unionRange.Merge(COleVariant((long)0)); 			
			//历史最大用户数合并
		}

		unionRange.AttachDispatch(range.GetItem(COleVariant(usedRowNum+1),COleVariant((long)1)).pdispVal);
		unionRange.AttachDispatch(unionRange.GetResize(COleVariant((long)portCount),COleVariant((long)6)));
		unionRange.SetRowHeight(COleVariant(13.5));
		bord = unionRange.GetBorders();
		bord.SetLineStyle(COleVariant((short)1));  //设置边框



		handleFile.Replace("正在处理...","已完成");
		pList->DeleteString(n_host);
		pList->InsertString(n_host,handleFile);
		pList->UpdateWindow();
	}

	CTime time;
	time = time.GetCurrentTime();
	infos = time.Format("%Y%m%d%H%M%S");  //time.Format();
	info = _T("巡检报表") + infos + _T(".xlsx");
	info = xj_FilePath + info;
	info.Replace("\\\\","\\");

	xj_book.SaveAs(COleVariant(info),covOptional,covOptional,covOptional,covOptional,covOptional,0,covOptional,covOptional,covOptional,covOptional,covOptional);
	
	if(error == true )
	{
		MessageBox("巡检报表已完成,已保存到\r\n" + info + "\r\n有文件打开错误,点击\"确定\"返回查看","有文件打开错误!",MB_OK|MB_ICONWARNING);
		app.Quit();
	}
	else 
	{
		if(MessageBox("巡检报表已完成,已保存到\r\n" + info + "\r\n点击\"确定\"打开文件查看","生成报表完成",MB_OKCANCEL) == IDOK)
		{
			app.SetVisible(TRUE);
			app.SetUserControl(TRUE);
		}
		else app.Quit();
	}
}
catch (CFileException* e)
    {
        e->ReportError();
        e->Delete();
    }
	//CDialog::OnOK();
}
开发者ID:huoqi,项目名称:HeBei_Telecom_Interface_flow,代码行数:101,代码来源:XunJianDlg.cpp

示例6: RequestDlgProc_NewProcess

LRESULT CALLBACK RequestDlgProc_NewProcess(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
	Request_StartProcess* pRequest;
	switch (wMsg)
	{ 
	case WM_INITDIALOG:
		SetWindowLong(hWnd, DWL_USER, 0);
		SetTimer(hWnd, _TIMER_NEWPROCESS_WND, 1000, NULL);
		break;
	case WM_TIMER:
		pRequest = (Request_StartProcess*) GetWindowLong(hWnd, DWL_USER);
		if (pRequest != NULL)
		{
			CTime Current = Current.GetCurrentTime();
			CTimeSpan spanCurrent(Current.GetTime());

			if (pRequest->m_StartTime <= Current)
				PostMessage(hWnd, WM_COMMAND, IDOK, 0);
			else
			{
				CTimeSpan span(pRequest->m_StartTime.GetTime());

				CString strtmp;
				span -= spanCurrent;
				strtmp = span.Format("time elapse %M min %S (sec)");
				
				SetDlgItemText(hWnd, IDC_STATIC_TIME_ELAPSE, strtmp);
			}
		}
		return TRUE;
		break;
	case WM_CLOSE:
		break;
	case WM_DESTROY:
		KillTimer(hWnd, _TIMER_NEWPROCESS_WND);
		break;
	case WM_CONTEXTMENU:
		break;
	case WM_PAINT:
		pRequest = (Request_StartProcess*) GetWindowLong(hWnd, DWL_USER);
		if (pRequest != NULL)
		{
			PAINTSTRUCT paint;
			HDC hdc = BeginPaint(hWnd, &paint);
			HICON hIcon = pRequest->wininfo.GetIcon(true);
			if (hIcon != NULL)
			{
				RECT rect;
				GetWindowRect(GetDlgItem(hWnd, IDC_STATIC_FILEICON), &rect);
				MapWindowPoints(0, hWnd, (LPPOINT) &rect, 2);
				DrawIcon(hdc, rect.left, rect.top, hIcon);
			}
			EndPaint(hWnd, &paint);
		}
		return TRUE;
		break;
	case WU_REQUESTUPDATE:
		SetWindowLong(hWnd, DWL_USER, wParam);
		SendMessage(hWnd, WM_TIMER, _TIMER_NEWPROCESS_WND, 0);

		pRequest = (Request_StartProcess*) wParam;
		{
			CString strInfo;
			CString strtmp;

			strInfo = *pRequest->m_pstrInfo;
			strInfo += _T("\r\n\r\n");

			if (pRequest->wininfo.QueryInfo(pRequest->m_pwchImagePath))
			{
				strtmp.Format(_T("Image path: %s\r\nVersion: <unknown>\r\nDescription: <not present>"), 
					pRequest->m_pwchImagePath);
			}
			else
			{
				strtmp.Format(_T("Image path: %s\r\nVersion: %s\r\nDescription: %s"), 
					pRequest->m_pwchImagePath, 
					pRequest->wininfo.GetProductVersion(),
					pRequest->wininfo.GetFileDescription());
			}

			strInfo += strtmp;

			SetDlgItemText(hWnd, IDC_EDIT_INFO, strInfo);

			if (pRequest->m_bSandBoxed)
				EnableWindow(GetDlgItem(hWnd, IDOK), FALSE);
		}
		
		ShowWindow(hWnd, SW_SHOW);
		SetForegroundWindow(hWnd);
		SetFocus(hWnd);
		UpdateWindow(hWnd);

		return TRUE;
		break;
	case WM_COMMAND:
		{
			switch (LOWORD (wParam)) 
			{
//.........这里部分代码省略.........
开发者ID:hackshields,项目名称:antivirus,代码行数:101,代码来源:ThNewProcess.cpp

示例7: AutoNumber

/*
	µ±nStyle=1ʱ Éú³ÉÊý×Ö±àºÅ
	µ±nStyle=2ʱ Éú³ÉÁ÷Ë®ÕʺÅ
	µ±nStyle=3ʱ Éú³ÉÈÕÆÚʱ¼ä±àºÅ
*/
CString RxADO::AutoNumber(CString sTable, CString sFieldName, CString sCode, int nStyle)
{
 	_RecordsetPtr AutoNumberrst;
 	CString sTempNewNumber,sNewNumber,sSQL,sMaxNumber,sOldNumber;
 	AutoNumberrst.CreateInstance(__uuidof(Recordset));
 	sSQL.Format("SELECT MAX(%s) as ×î´ó±àºÅ FROM %s",sFieldName,sTable);
	try{
	AutoNumberrst=cnn->Execute((_bstr_t)sSQL,NULL,adCmdText);		
	}
	catch(_com_error & e)
	{
		GetADOErrors(e);
	}
	if(nStyle==1) //Êý×Ö±àºÅ
 	{
 		if(GetRecordCount(AutoNumberrst)<1)
			sNewNumber.Format("1");
		else
	{
		AutoNumberrst->MoveFirst();
		_variant_t vtext;
		vtext=AutoNumberrst->GetCollect("×î´ó±àºÅ");
		if(vtext.vt==VT_EMPTY||vtext.vt==VT_NULL)
		{
			sNewNumber.Format("1");
			goto end;
		}
		sMaxNumber=(char*)(_bstr_t)AutoNumberrst->GetCollect("×î´ó±àºÅ");
			sNewNumber.Format("%d",atoi(sMaxNumber)+1);
		}
	}
	if(nStyle==2)//Á÷Ë®ÕʺÅ
	{
		if(GetRecordCount(AutoNumberrst)<1)
			sNewNumber.Format("%s00000001",sCode);
		else
 		{
			AutoNumberrst->MoveFirst();
			_variant_t _bOldNumber=AutoNumberrst->GetCollect("×î´ó±àºÅ");
			if(_bOldNumber.vt==VT_NULL || _bOldNumber.vt==VT_EMPTY)
			{
				sNewNumber.Format("%s00000001",sCode);
				goto end;
			}
			sOldNumber=(char*)(_bstr_t) _bOldNumber;
			sMaxNumber=sOldNumber.Mid(3); 
			sTempNewNumber.Format("%d",atoi(sMaxNumber)+1);
			sNewNumber.Format("%s%s",sCode,Padl(sTempNewNumber,8,"0",1));
		}

	}
	if(nStyle==3)//ÈÕÆÚʱ¼ä±àºÅ
	{
		int nYear,nDay,nMonth;
		CString sYear,sDay,sMonth;
		CTime tTime;
 		tTime=tTime.GetCurrentTime(); 
		nYear=tTime.GetYear();
		nDay=tTime.GetDay();
		nMonth=tTime.GetMonth();
		sYear.Format("%d",nYear);
		sDay.Format("%d",nDay);
		sMonth.Format("%d",nMonth);
 		
		sYear=sYear.Mid(2);
		sDay=Padl(sDay,2,"0",1);
		sMonth=Padl(sMonth,2,"0",1);
 		if(GetRecordCount(AutoNumberrst)<1)
			sNewNumber.Format("%s%s%s%s-000001  ",sCode,sYear,sMonth,sDay);
		else
		{
			_variant_t bh=AutoNumberrst->GetCollect("×î´ó±àºÅ");
			if(bh.vt==VT_EMPTY||bh.vt==VT_NULL)
			{
				sNewNumber.Format("%s%s%s%s-000001  ",sCode,sYear,sMonth,sDay);
				goto end;
			}
			CString sOldDate,sNewDate;
			AutoNumberrst->MoveFirst();
 			sOldNumber=(char*)(_bstr_t)AutoNumberrst->GetCollect("×î´ó±àºÅ");
 			sOldDate=sOldNumber.Mid(2,6);
			sNewDate.Format("%s%s%s",sYear,sMonth,sDay);
			if(sOldDate==sNewDate)
			{
				sMaxNumber=sOldNumber.Mid(9);
				sTempNewNumber.Format("%d",atoi(sMaxNumber)+1);
				sNewNumber.Format("%s%s%s%s-%s",sCode,sYear,sMonth,sDay,Padl(sTempNewNumber,6,"0",1));
 			}
 			else
				sNewNumber.Format("%s%s%s%s-000001  ",sCode,sYear,sMonth,sDay);		
		}
 	}
end: 	return sNewNumber;
}
开发者ID:ice98,项目名称:mycode_bak,代码行数:99,代码来源:RxADO.cpp


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