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


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

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


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

示例1: GetEphemerisNmae

CString CGetEphemerisDlg::GetEphemerisNmae()
{
	CString f;
	CTime t = CTime::GetCurrentTime();
	f.Format("NMEA%02d-%02d-%02d_%02d%02d%02d.txt", t.GetYear(), t.GetMonth(), t.GetDay(),
		t.GetHour(), t.GetMinute(), t.GetSecond());

	switch(ephType)
	{
	case GpsEphemeris:
		f.Format("GPS_Ephemeris%02d-%02d-%02d_%02d%02d%02d.log", t.GetYear(), t.GetMonth(), t.GetDay(),
			t.GetHour(), t.GetMinute(), t.GetSecond());
		break;
	case GlonassEphemeris:
		f.Format("Glonass_Ephemeris%02d-%02d-%02d_%02d%02d%02d.log", t.GetYear(), t.GetMonth(), t.GetDay(),
			t.GetHour(), t.GetMinute(), t.GetSecond());
		break;
	case BeidouEphemeris:
		f.Format("Beidou_Ephemeris%02d-%02d-%02d_%02d%02d%02d.log", t.GetYear(), t.GetMonth(), t.GetDay(),
			t.GetHour(), t.GetMinute(), t.GetSecond());
		break;
	case GalileoEphemeris:
		f.Format("Galileo_Ephemeris%02d-%02d-%02d_%02d%02d%02d.log", t.GetYear(), t.GetMonth(), t.GetDay(),
			t.GetHour(), t.GetMinute(), t.GetSecond());
		break;
	default:
		ASSERT(FALSE);
		break;
	}
	return f;
}
开发者ID:asion0,项目名称:GNSS_Viewer_V2,代码行数:31,代码来源:Ephems.cpp

示例2: OnPaint

void CLEDClock::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
/*---------------------进行初始化的显示-------------------*/
	CRect rectClient;
	GetClientRect(&rectClient);
	m_h = rectClient.Height();
	m_w = rectClient.Width()/8;
	CTime time = CTime::GetCurrentTime();
	int nh1 = time.GetHour()/10;
	if(nh1)
		Output(nh1, 0);
	else 
		Output(11, 0);
	int nh2 = time.GetHour()%10;
	Output(nh2, 1);
	int nm1 = time.GetMinute()/10;
	Output(nm1, 3);
	int nm2 = time.GetMinute()%10;
	Output(nm2, 4);
	int ns1 = time.GetSecond()/10;
	Output(ns1, 6);
	int s2 = time.GetSecond()%10;
	Output(s2, 7);
	Output(10, 2); // double points
	Output(10, 5); // double points
	// Do not call CStatic::OnPaint() for painting messages
}
开发者ID:Strongc,项目名称:keshiduijiang,代码行数:30,代码来源:EDCLOCK.CPP

示例3: WriteLog

BOOL WriteLog(WCHAR *szFile,CTime StartTime,CTime EndTime,BOOL bSucc)
{
	CString strText,strResult;
	WCHAR    szUserName[MAX_PATH],szLogFile[MAX_PATH];
	HANDLE  hFile;
	WORD    wUnicodeSign = 0;
	ULONG	ulEnter = 0x000a000d;
	ULONG	ulLen = MAX_PATH,dwWrtited;

	GetUserName(szUserName,&ulLen);

	strResult.LoadString(bSucc?IDS_RESULT_SUCC:IDS_RESULT_FAIL);
	strText.Format(IDS_LOG_FORMAT,szFile,szUserName,
					StartTime.GetYear(),StartTime.GetMonth(),StartTime.GetDay(),
					StartTime.GetHour(),StartTime.GetMinute(),StartTime.GetSecond(),
					EndTime.GetYear(),EndTime.GetMonth(),EndTime.GetDay(),
					EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond(),
					g_nDelMethod, strResult);

	////GetSystemDirectory(szLogFile,MAX_PATH);
	//ZeroMemory(szLogFile, MAX_PATH * sizeof(WCHAR));
	//WCHAR chCurrentProcessName[MAX_PATH];
	//WCHAR *pDest = NULL;
	//GetModuleFileName(NULL,chCurrentProcessName,MAX_PATH);

	//wcscpy(szLogFile,chCurrentProcessName);
	//pDest = wcsstr(szLogFile,L"\\DelFile.exe");
	//*pDest = L'\0';		
	CString path;
	GetLocalDir(path);
	path += L"\\dm.log";
	//wcscat(szLogFile,L"\\dm.log");
	hFile = CreateFile(path,GENERIC_READ|GENERIC_WRITE,
					 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
					 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
					 NULL);
	if (hFile == INVALID_HANDLE_VALUE)
	{
		strText.Format(IDS_LOG_FAIL,path);
		AfxMessageBox(strText);
		return FALSE;
	}

	ReadFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
	if (wUnicodeSign != 0xfeff)
	{
		wUnicodeSign = 0xfeff;
		SetFilePointer(hFile,0,NULL,FILE_BEGIN);
		WriteFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
	}
	else SetFilePointer(hFile,0,NULL,FILE_END);
	WriteFile(hFile,strText,strText.GetLength()*sizeof(WCHAR),&dwWrtited,NULL);
	WriteFile(hFile,&ulEnter,sizeof(ULONG),&dwWrtited,NULL);
	SetEndOfFile(hFile);
	CloseHandle(hFile);
	return TRUE;
}
开发者ID:xfxf123444,项目名称:japan,代码行数:57,代码来源:Fun.cpp

示例4: OnTimer

void CLEDClock::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	if(nIDEvent == m_nTimer) {
		m_nCount++;
		CRect rectClient;
		GetClientRect(&rectClient);
		m_h = rectClient.Height();
		if(m_style == XDC_SECOND) {
			m_w = rectClient.Width()/8;
		} else {
			m_w = rectClient.Width()/5;
		}

		CTime time = CTime::GetCurrentTime();
		int nh1 = time.GetHour()/10;
		if(nh1)
			Output(nh1, 0);
		else 
			Output(11, 0);
		int nh2 = time.GetHour()%10;
		Output(nh2, 1);
		int nm1 = time.GetMinute()/10;
		Output(nm1, 3);
		int nm2 = time.GetMinute()%10;
		Output(nm2, 4);

		switch(m_style) {
			case XDC_SECOND:
			{
				int ns1 = time.GetSecond()/10;
   				Output(ns1, 6);
				int s2 = time.GetSecond()%10;
				Output(s2, 7);
				Output(10, 2); // double points
				Output(10, 5); // double points
			}
			break;
			case XDC_NOSECOND:
			default:
				if(m_bAlarm)
					Output(10, 2);
				else 
					if(m_nCount%2)
						Output(10, 2); // double points
					else 
						Output(11, 2); // 
				break;
		}
		if(m_bAlarm)
			MessageBeep(-1);
	}
	CStatic::OnTimer(nIDEvent);
}
开发者ID:Strongc,项目名称:keshiduijiang,代码行数:54,代码来源:EDCLOCK.CPP

示例5: TimeThread

DWORD WINAPI TimeThread(LPVOID lpParameter)
{
	HWND hWnd = FindWindow("TimerCron", NULL);
	CTime NowTime;
	CString CurrentTime,Second;
	while (true)
	{
	NowTime = CTime::GetCurrentTime();
	NowTime.GetSecond() > 10 ? Second.Format("%d", NowTime.GetSecond()) : Second.Format("0%d", NowTime.GetSecond());
	CurrentTime.Format("%d-%d-%d %d:%d:%s", NowTime.GetYear(), NowTime.GetMonth(), NowTime.GetDay(), NowTime.GetHour(), NowTime.GetMinute(), Second);
	::PostMessage(hWnd, WM_GET_NOW_TIME, (WPARAM)CurrentTime.GetBuffer(), 0);
	Sleep(1000);
	}
}
开发者ID:zhaobisheng,项目名称:TimerCron-tool,代码行数:14,代码来源:TimerCron.cpp

示例6: WriteLog

BOOL WriteLog(WCHAR *szFile,CTime StartTime,CTime EndTime,BOOL bSucc)
{
	CString strText,strResult;
	WCHAR    szUserName[MAX_PATH];
	CString szLogFile;
	HANDLE  hFile;
	WORD    wUnicodeSign = 0;
	ULONG	ulEnter = 0x000a000d;
	ULONG	ulLen = MAX_PATH,dwWrtited;

	GetUserName(szUserName,&ulLen);

	strResult.LoadString(bSucc?IDS_RESULT_SUCC:IDS_RESULT_FAIL);
	strText.Format(IDS_LOG_FORMAT,szFile,szUserName,
					StartTime.GetYear(),StartTime.GetMonth(),StartTime.GetDay(),
					StartTime.GetHour(),StartTime.GetMinute(),StartTime.GetSecond(),
					EndTime.GetYear(),EndTime.GetMonth(),EndTime.GetDay(),
					EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond(),
					strResult);

	//GetSystemDirectory(szLogFile,MAX_PATH);
	GetLocalDir(szLogFile);
	szLogFile += L"\\dm.log";

	hFile = CreateFile(szLogFile,GENERIC_READ|GENERIC_WRITE,
					 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
					 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
					 NULL);
	if (hFile == INVALID_HANDLE_VALUE)
	{
		strText.Format(IDS_LOG_FAIL,szLogFile);
		AfxMessageBox(strText);
		return FALSE;
	}

	ReadFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
	if (wUnicodeSign != 0xfeff)
	{
		wUnicodeSign = 0xfeff;
		SetFilePointer(hFile,0,NULL,FILE_BEGIN);
		WriteFile(hFile,&wUnicodeSign,sizeof(WORD),&dwWrtited,NULL);
	}
	else SetFilePointer(hFile,0,NULL,FILE_END);
	WriteFile(hFile,strText.GetBuffer(0),strText.GetLength()*sizeof(WCHAR),&dwWrtited,NULL);
	WriteFile(hFile,&ulEnter,sizeof(ULONG),&dwWrtited,NULL);
	SetEndOfFile(hFile);
	CloseHandle(hFile);
	return TRUE;
}
开发者ID:xfxf123444,项目名称:japan,代码行数:49,代码来源:Fun.cpp

示例7: ParseStringToTime

BOOL CSkinSection::ParseStringToTime(const CString &str, CTime &tm)
{
	int nLen = str.GetLength();
	if ( nLen < 10)
		return FALSE;

	int nHead = -1;
	int nTail = -1;
	CTime tmNow = CTime::GetCurrentTime();
	int nVal[6] = {tmNow.GetYear(),tmNow.GetMonth(),tmNow.GetDay(),
					tmNow.GetHour(),tmNow.GetMinute(),tmNow.GetSecond()};
	
	for (int i=0; i<6; i++)
	{
		nHead = nTail + 1;
		nTail = str.Find(',',nHead + 1);
		
		if (nTail < 0)
			nTail = nLen;

		nVal[i] = atoi(str.Mid(nHead,nTail - nHead));
	}
	tm = CTime(nVal[0],nVal[1],nVal[2],nVal[3],nVal[4],nVal[5]);
	
	return TRUE;
}
开发者ID:smallfishincup,项目名称:biyesheji,代码行数:26,代码来源:SkinIniFile.cpp

示例8: configure

ICQ_EXPORT void configure(IcqProfile *profile)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CConfigDlg dlg;
	dlg.m_enable = alarmEnabled;
	dlg.m_date = alarmTime;
	dlg.m_time = alarmTime;
	dlg.m_text = alarmText.c_str();

	if (dlg.DoModal() != IDOK)
		return;

	alarmEnabled = dlg.m_enable;
	alarmTime = CTime(dlg.m_date.GetYear(), dlg.m_date.GetMonth(), dlg.m_date.GetDay(),
		dlg.m_time.GetHour(), dlg.m_time.GetMinute(), dlg.m_time.GetSecond());
	alarmText = dlg.m_text;

	profile->writeBool("enable", alarmEnabled ? true : false);
	profile->writeInt("year", alarmTime.GetYear());
	profile->writeInt("month", alarmTime.GetMonth());
	profile->writeInt("day", alarmTime.GetDay());
	profile->writeInt("hour", alarmTime.GetHour());
	profile->writeInt("minute", alarmTime.GetMinute());
	profile->writeInt("second", alarmTime.GetSecond());
	profile->writeString("text", alarmText.c_str());

	if (alarmEnabled)
		setTimer(alarmTime);
}
开发者ID:bugou,项目名称:test,代码行数:30,代码来源:alarm.cpp

示例9: CTimeToULong

unsigned long  CCommClass::CTimeToULong(CTime time)
{  
	
    int  days[13] = { 0, 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;
    int  day  , i ;
    unsigned long  seconds ;
    
    seconds =    0 ;
    day     =    0 ;
    
	bool bLeapYear = time.GetYear()%400 == 0 || ( time.GetYear()%4 == 0 && time.GetYear()%100 != 0 ) ;
    if( !bLeapYear )
        days[2] = 28 ;
    
    for( i = 0 ; i < ( time.GetYear()-2000 ) ; i++ )    
    {
		bLeapYear = (2000+i)%400 == 0 || ( (2000+i)%4 == 0 && (2000+i)%100 != 0 ) ;
        if( bLeapYear )
            day += 366 ;
        else
            day += 365 ;
    }    
    for( i = 1 ; i < time.GetMonth() ; i++ ) 
    {
        day += days[i] ;
    }       
    day += ( time.GetDay() - 1 );     
    
    seconds = ( day * 24 + time.GetHour() )*3600 + time.GetMinute() * 60 + time.GetSecond() ;
    return seconds ;    
}
开发者ID:shengang1978,项目名称:HH,代码行数:31,代码来源:CommClass.cpp

示例10: sizeof

void CXuser32App::LogMessage(LPCTSTR pszLog, BOOL bShowTime)
{
	CFile pFile;
	
	if ( pFile.Open( _T("Xuser32.log"), CFile::modeReadWrite ) )
	{
		pFile.Seek( 0, CFile::end );
	}
	else
	{
		if ( ! pFile.Open( _T("Xuser32.log"), CFile::modeWrite|CFile::modeCreate ) ) return;
	}

	if ( bShowTime )
	{
		CTime pNow = CTime::GetCurrentTime();
		CString strLine;
		
		strLine.Format( _T("[%.2i:%.2i:%.2i] %s\r\n"),
			pNow.GetHour(), pNow.GetMinute(), pNow.GetSecond(), pszLog );
		
		pFile.Write( (LPCTSTR)strLine, sizeof(TCHAR) * strLine.GetLength() );
	}
	else
	{
		pFile.Write( pszLog, sizeof(TCHAR) * _tcslen(pszLog) );
		pFile.Write( _T("\r\n"), sizeof(TCHAR) * 2 );
	}
	
	pFile.Close();
}
开发者ID:pics860,项目名称:callcenter,代码行数:31,代码来源:Xuser32.cpp

示例11: AfxTimeToFileTime

void AFX_CDECL AfxTimeToFileTime(const CTime& time, LPFILETIME pFileTime)
{
	ASSERT(pFileTime != NULL);

	if (pFileTime == NULL) 
	{
		AfxThrowInvalidArgException();
	}

	SYSTEMTIME sysTime;
	sysTime.wYear = (WORD)time.GetYear();
	sysTime.wMonth = (WORD)time.GetMonth();
	sysTime.wDay = (WORD)time.GetDay();
	sysTime.wHour = (WORD)time.GetHour();
	sysTime.wMinute = (WORD)time.GetMinute();
	sysTime.wSecond = (WORD)time.GetSecond();
	sysTime.wMilliseconds = 0;

	// convert system time to local file time
	FILETIME localTime;
	if (!SystemTimeToFileTime((LPSYSTEMTIME)&sysTime, &localTime))
		CFileException::ThrowOsError((LONG)::GetLastError());

	// convert local file time to UTC file time
	if (!LocalFileTimeToFileTime(&localTime, pFileTime))
		CFileException::ThrowOsError((LONG)::GetLastError());
}
开发者ID:jbeaurain,项目名称:omaha_vs2010,代码行数:27,代码来源:filest.cpp

示例12: 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

示例13: RepackFile

BOOL CMailChannel::RepackFile(LPCTSTR xFaxFile)
{
	CString xNewFile;
	SYSTEMTIME pTime;
	GetLocalTime( &pTime );
	
	xNewFile.Format( "%04i%02i%02i%02i%02i%02i%03i.tif",
		pTime.wYear, pTime.wMonth, pTime.wDay,
		pTime.wHour, pTime.wMinute, pTime.wSecond, pTime.wMilliseconds );

	int nResult =
	fBmp_CutTifHeader( (LPSTR)xFaxFile, xNewFile.GetBuffer(0), 16, -1,  0 );
	if ( nResult == -1 ) return FALSE;
	
	CTime pNow = CTime::GetCurrentTime();
	
	CHAR xDateTime[32];
	sprintf( xDateTime, "%.4i-%.2i-%.2i %.2i:%.2i:%.2i",
		pNow.GetYear(), pNow.GetMonth(), pNow.GetDay(),	
		pNow.GetHour(), pNow.GetMinute(), pNow.GetSecond() );
	
	nResult =
	fBmp_AddTxtToTif( xNewFile.GetBuffer(0), RemoteId, FaxNumber, "",
		xDateTime, (LPSTR)xFaxFile, 0 );
	if ( nResult == -1 ) return FALSE;
	
	DeleteFile( xNewFile );
	
	return TRUE;
}
开发者ID:pics860,项目名称:callcenter,代码行数:30,代码来源:channelmail.cpp

示例14: OnTimer

void CSetTimeShutdown::OnTimer(UINT nIDEvent) 
{
  int hour,min,sec;
  int yhour,ymin,ysec;
    
    CTime nowtime = CTime::GetCurrentTime();
	m_sNowTime = nowtime.Format(_T("%Y-%m-%d %H:%M:%S"));

	UpdateData(FALSE);

	if(bSetTime)
	{
	hour = nowtime.GetHour();
	min	 = nowtime.GetMinute();
	sec  = nowtime.GetSecond();

	yhour = m_Time.GetHour();
	ymin  = m_Time.GetMinute();
	ysec  = m_Time.GetSecond();

	//如果时间到,则关机
	if(hour == yhour && min == ymin )
	    WinShutdown(EWX_SHUTDOWN);
	}

	
	CDialog::OnTimer(nIDEvent);
}
开发者ID:chengkaizone,项目名称:LovePet,代码行数:28,代码来源:SetTimeShutdown.cpp

示例15: DebugPrintf

/*
* 打印日志文件
*/
void CServerGameDesk::DebugPrintf(const char *p, ...)
{
	if(!m_bWriteLog || NULL == m_pDataManage)
	{
		return;
	}
	return;
	char szFilename[256];
	CString strPath = CINIFile::GetAppPath() +"\\GameLog\\";

	SHCreateDirectoryEx(NULL, strPath, NULL);

	CTime time = CTime::GetCurrentTime();

	sprintf(szFilename, "%s%d_%d_%d_%d%d%d_log.txt",strPath ,NAME_ID,m_pDataManage->m_InitData.uRoomID,m_bDeskIndex,time.GetYear(), time.GetMonth(), time.GetDay());
	FILE *fp = fopen( szFilename, "a" );
	if (NULL == fp)
	{
		return;
	}

	//插入时间
	char cTime[30];
	::memset(cTime,0,sizeof(cTime));
	sprintf(cTime,"[%d:%d:%d] ",time.GetHour(),time.GetMinute(),time.GetSecond());
	fprintf(fp,cTime);

	va_list arg;
	va_start( arg, p );
	vfprintf(fp, p, arg );
	fprintf(fp,"\n");

	fclose(fp);
}
开发者ID:liuwanbing,项目名称:liuwanbing,代码行数:37,代码来源:ServerManage.cpp


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