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


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

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


在下文中一共展示了CTime::GetYear方法的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: OnBnClickedUpdateLyest

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

	m_radio = 3;

	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(1, 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

示例3: AllSaveRoutine

void CAujardDlg::AllSaveRoutine()
{
	CTime cur = CTime::GetCurrentTime();
	DEBUG_LOG("Server down : %02d/%02d/%04d %02d:%02d", cur.GetYear(), cur.GetMonth(), cur.GetDay(), cur.GetHour(), cur.GetMinute());

	int size = m_DBAgent.m_UserDataArray.size();
	for (int i = 0; i < size; i++)
	{
		_USER_DATA *pUser = m_DBAgent.m_UserDataArray[i];
		if (pUser == NULL || *pUser->m_Accountid == 0)
			continue;

		string strAccountID = pUser->m_Accountid;
		string strCharID = pUser->m_id;

		m_DBAgent.AccountLogout(strAccountID);
		m_DBAgent.UpdateWarehouseData(strAccountID, i, UPDATE_ALL_SAVE);
		m_DBAgent.UpdateUser(strCharID, i, UPDATE_ALL_SAVE);

		m_DBAgent.MUserInit(i);
		Sleep(50);
	}

	CString msg;
	msg.Format("All data saved: %04d/%02d/%02d %02d:%02d", cur.GetYear(), cur.GetMonth(), cur.GetDay(), cur.GetHour(), cur.GetMinute());
	m_OutputList.AddString(msg);
}
开发者ID:Rithual,项目名称:snoxd-koserver,代码行数:27,代码来源:AujardDlg.cpp

示例4: InitControl

BOOL CDlgHistoryLogUser::InitControl()
{
	// 查询结果列表中需要显示的列包括了:开始时间、结束时间、摄像头名称、
	DWORD dwStyle;
	dwStyle = m_ListCtrl_UserLog.GetStyle();
	dwStyle = LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT;
	m_ListCtrl_UserLog.SetExtendedStyle(dwStyle);

	InitControlList();

	m_strNodeName = "全部用户";

//	m_ComboType.InsertString(0, "所有类型");
	m_ComboType.InsertString(0,"管理端操作");
	m_ComboType.InsertString(1,"客户端操作");
	m_ComboType.InsertString(2,"辅助管理端操作");
	m_ComboType.SetCurSel(0);

	m_ComboSubType.InsertString(0, "所有分类型");
	m_ComboSubType.SetCurSel(0);

	CTime	nowtime	= CTime::GetCurrentTime();
	CTime	StartTime(nowtime.GetYear(), nowtime.GetMonth(),nowtime.GetDay(), 0, 0, 0);
	CTime	StopTime(nowtime.GetYear(), nowtime.GetMonth(), nowtime.GetDay(), 23, 59, 59);

	//开始时间初始化
	m_StartDay = StartTime;
	m_StartTime = StartTime;
	m_StopDay  = StopTime;
	m_StopTime  = StopTime;

	UpdateData(FALSE);

	return TRUE;
}
开发者ID:github188,项目名称:MonitorSystem,代码行数:35,代码来源:DlgHistoryLogUser.cpp

示例5: GetNowTime

CTime GetNowTime(short nPeriod)
{
	if(nPeriod == PERIOD_TYPE_DAY)
	{
		CTime now = CTime::GetCurrentTime();
		CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),0,0,0);
		return t;
	}
	else if (nPeriod == PERIOD_TYPE_MINUTE1)
	{
		CTime now = CTime::GetCurrentTime();
		CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),now.GetHour(),now.GetMinute(),0);
		return t;
	}
	else if (nPeriod == PERIOD_TYPE_MINUTE5)
	{
		CTime now = CTime::GetCurrentTime();
		int nMinute = now.GetMinute() / 5 * 5;
		CTime t(now.GetYear(),now.GetMonth(),now.GetDay(),now.GetHour(),nMinute,0);
		return t;
	}
	else
	{
		return CTime::GetCurrentTime();
	}
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:26,代码来源:HSDownloadData.cpp

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

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

示例8: CheckDecryptOption

BOOL CheckDecryptOption(PENCRYPTOPTION pOption)
{
	CString strText,strTitle;

	if (!pOption->bOptionOn) return TRUE;
	if (pOption->bErrorLimit)
	{
		if	(pOption->uCurrentErr >= pOption->ulErrorLimit)
		{
			strText.Format(IDS_LIMIT_ERROR,pOption->ulErrorLimit);
#ifndef _YG_COMMAND_LINE
			strTitle.LoadString(IDS_APP_NAME);
			MessageBox(GetFocus(),strText,strTitle,MB_OK | MB_ICONWARNING);
#else
			wcout << (LPCTSTR)strText << endl;
#endif
			return FALSE;
		}
	}

	if (pOption->bLimitCount)
	{
		if (pOption->ulCurrentCount >= pOption->ulMaxCount)
		{
			strText.Format(IDS_REACH_LIMIT_COUNT,pOption->ulMaxCount);
#ifndef _YG_COMMAND_LINE
			strTitle.LoadString(IDS_APP_NAME);
			MessageBox(GetFocus(),strText,strTitle,MB_OK | MB_ICONWARNING);
#else
		    wcout << (LPCTSTR)strText << endl;
#endif
			return FALSE;
		}
	}

	if (pOption->bLimitTime)
	{
		CTime CurrentTime = CTime::GetCurrentTime();

		if ((pOption->LimitTime.GetYear() < CurrentTime.GetYear()) ||
			((pOption->LimitTime.GetYear() == CurrentTime.GetYear()) && (pOption->LimitTime.GetMonth() < CurrentTime.GetMonth())) ||
			((pOption->LimitTime.GetYear() == CurrentTime.GetYear()) && (pOption->LimitTime.GetMonth() == CurrentTime.GetMonth()) && (pOption->LimitTime.GetDay() < CurrentTime.GetDay())))
		{
			strText.Format(IDS_LIMIT_TIME,pOption->LimitTime.GetYear(),pOption->LimitTime.GetMonth(),pOption->LimitTime.GetDay());
#ifndef _YG_COMMAND_LINE
			strTitle.LoadString(IDS_APP_NAME);
			MessageBox(GetFocus(),strText,strTitle,MB_OK | MB_ICONWARNING);
#else
		    wcout << (LPCTSTR)strText << endl;
#endif
			return FALSE;
		}
	}

	return TRUE;
}
开发者ID:xfxf123444,项目名称:japan,代码行数:56,代码来源:DavinciFunction.cpp

示例9: SetLoginTime

void CDlgETradeLoginStatus::SetLoginTime(){
	CTime currentTime = CTime::GetCurrentTime();
	CTime timeStartToSet(currentTime.GetYear(), currentTime.GetMonth(), currentTime.GetDay(), 8, 50, 0);
	CTime timeEndToSet(currentTime.GetYear(), currentTime.GetMonth(), currentTime.GetDay(), 15, 30, 0);

	this->timeCtrlStart.SetTime(&timeStartToSet);
	this->timeCtrlEnd.SetTime(&timeEndToSet);
	
	this->checkKeepLogin.SetCheck(loginInfo.GetLoginTime().GetChecker());
}
开发者ID:sanghapark,项目名称:TradingSystem,代码行数:10,代码来源:DlgETradeLoginStatus.cpp

示例10: GetDate

CString GetDate(int offset, BOOL ndHMS)
{
	CString res;
	//SYSTEMTIME st;
	//GetLocalTime(&st);
	CTime st = CTime::GetCurrentTime();
	CTimeSpan span(offset,0,0,0);
	st = st+span;
	if(ndHMS)
		res.Format("%d-%.2d-%.2d %.2d:%.2d:%.2d",st.GetYear(),st.GetMonth(),st.GetDay(),st.GetHour(),st.GetMinute(),st.GetSecond());
	else
		res.Format("%d-%.2d-%.2d",st.GetYear(),st.GetMonth(),st.GetDay());
	return res;
}
开发者ID:anzhsoft,项目名称:Readings,代码行数:14,代码来源:StdAfx.cpp

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

示例12: GetMyCurrentTime

void CPalletID::GetMyCurrentTime(CString &time,bool flag)
{
	CTime tm; 
	tm=CTime::GetCurrentTime(); 
	if (flag)
	{
		time.Format(L"%d-%d-%d-%d-%d-%d",tm.GetYear(),tm.GetMonth(),tm.GetDay(),tm.GetHour(),tm.GetMinute(),tm.GetSecond());
	}
	else
	{
		int temp = tm.GetYear() / 1000;
		temp = tm.GetYear() - temp * 1000;
		time.Format(L"%02d%02d%02d",temp,tm.GetMonth(),tm.GetDay());
	}
}
开发者ID:HanoiGuo,项目名称:BoJay-SFIS,代码行数:15,代码来源:PalletID.cpp

示例13: OnInitDialog

BOOL CVideoRecvTestDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	SetIcon(m_hIcon, TRUE);
	SetIcon(m_hIcon, FALSE);

	CTime cTime = CTime::GetCurrentTime();
	char szTemp[20];
	sprintf(szTemp, "%d", cTime.GetYear());
	SetDlgItemText(IDC_EDIT2, szTemp);
	sprintf(szTemp, "%d", cTime.GetMonth());
	SetDlgItemText(IDC_EDIT3, szTemp);
	sprintf(szTemp, "%d", cTime.GetDay());
	SetDlgItemText(IDC_EDIT4, szTemp);
	sprintf(szTemp, "%d", cTime.GetHour());
	SetDlgItemText(IDC_EDIT5, szTemp);
	sprintf(szTemp, "%d", cTime.GetMinute()-1);
	SetDlgItemText(IDC_EDIT6, szTemp);
	sprintf(szTemp, "%d", cTime.GetSecond());
	SetDlgItemText(IDC_EDIT7, szTemp);
	SetDlgItemText(IDC_EDIT8, "60");
	SetTimer(1004, 1000, NULL);

	::GetClientRect(GetDlgItem(IDC_STATIC_VIDEO)->GetSafeHwnd(), &m_ShowFrameRect);
	return TRUE;
}
开发者ID:fangbaolei,项目名称:EC700IR,代码行数:26,代码来源:VideoRecvTestDlg.cpp

示例14: FindToday

CXMLElement* CHisReport::FindToday() const
{
    CString strValue;

    WORD nYear, nMonth, nDay;
    CTime tt = CTime::GetCurrentTime();
    nYear = tt.GetYear();
    nMonth = tt.GetMonth();
    nDay = tt.GetDay();

    for ( POSITION pos = m_pXML->GetElementIterator() ; pos ; )
    {
        CXMLElement* pXML = m_pXML->GetNextElement( pos );
        if ( ! pXML->IsNamed( _T("History") ) ) continue;

        WORD nYear2, nMonth2, nDay2;
        nYear2 = nMonth2 = nDay2 = 0;

        strValue = pXML->GetAttributeValue( _T("Date") );
        _stscanf( strValue, _T("%d年%d月%d日"), &nYear2, &nMonth2, &nDay2 );

        if ( nYear != nYear2 || nMonth != nMonth2 || nDay != nDay2 ) continue;

        return pXML;
    }

    return NULL;
}
开发者ID:shilinxu,项目名称:honglt-myproject,代码行数:28,代码来源:HisReport.cpp

示例15:

CDate::CDate(CTime& t)
{
	m_day = t.GetDay();
	m_month = t.GetMonth();
	m_year = t.GetYear();
	m_xmlname = "date";
}
开发者ID:sverhagen,项目名称:trillian-bdc,代码行数:7,代码来源:Date.CPP


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