Example #1
0
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();
	}
}
Example #2
0
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;
}
Example #3
0
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);
}
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;
}
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();
}
Example #6
0
void CDlgAlarmAnalysis::GetSetTime(int* nBegin, int* nEnd)
{
	CTime cTime;
	m_wndBeginTime.GetTime(cTime);
	*nBegin = 1000000 * cTime.GetMonth() + 10000 * cTime.GetDay() + 100 * 0 + 0;
	m_wndEndTime.GetTime(cTime);
	*nEnd = 1000000 * cTime.GetMonth() + 10000 * cTime.GetDay() + 100 * 23 + 59;
}
Example #7
0
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;
}
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());
}
Example #9
0
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;
}
Example #10
0
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;
}
Example #11
0
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());
	}
}
Example #12
0
void CDBProcess::ReConnectODBC(CDatabase *m_db, const char *strdb, const char *strname, const char *strpwd)
{
	char strlog[256];	memset( strlog, 0x00, 256);
	CTime t = CTime::GetCurrentTime();
	sprintf_s(strlog, 256, "[%d-%d %d:%d] Trying to reconnect to ODBC...\r\n", t.GetMonth(), t.GetDay(), t.GetHour(), t.GetMinute());
	LogFileWrite( strlog );

	// DATABASE 연결...
	CString strConnect;
	strConnect.Format (_T("DSN=%s;UID=%s;PWD=%s"), strdb, strname, strpwd);
	int iCount = 0;

	do{	
		iCount++;
		if( iCount >= 4 )
			break;

		m_db->SetLoginTimeout(10);

		try
		{
			m_db->OpenEx((LPCTSTR )strConnect, CDatabase::noOdbcDialog);
		}
		catch( CDBException* e )
		{
			e->Delete();
		}
		
	}while(!m_db->IsOpen());	
}
Example #13
0
void CShipment::GetMyCurrentTime(CString &time)
{
	CTime tm; 
	tm=CTime::GetCurrentTime(); 
	time.Format(L"%d-%d-%d-%d-%d-%d",tm.GetYear(),tm.GetMonth(),tm.GetDay(),tm.GetHour(),tm.GetMinute(),tm.GetSecond());

}
Example #14
0
void DebugPrintf2(int iRoomID, const char *p, ...)
{
	OutputDebugString("wx DebugPrintf2");
	/*if(!m_bWriteLog)
	{
	return ; 
	}*/
	return;
	char szFilename[1024];
	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, iRoomID, time.GetYear(), time.GetMonth(), time.GetDay(),time.GetHour());
	FILE *fp = fopen( szFilename, "a" );
	if (NULL == fp)
	{
		return;
	}
	va_list arg;
	va_start( arg, p );
	vfprintf(fp, p, arg );
	fprintf(fp,"\n");
	fclose(fp);
}
Example #15
0
void CDlgAlarmAnalysis::OnDtnCloseupEndTime(NMHDR *pNMHDR, LRESULT *pResult)
{
	int nBegin, nEnd;
	GetSetTime(&nBegin, &nEnd);
	CTime curTime;
	curTime = CTime::GetCurrentTime();
	int nCurTime = 1000000 * curTime.GetMonth() + 10000 * curTime.GetDay() + 100 * 23 + 59;

	if( m_nOldEndTime < 0 || m_nOldBeginTime < 0 )
	{
		m_nOldBeginTime = nBegin;
		m_nOldEndTime = nEnd;
	}

	if( nBegin >= nEnd || nCurTime < nEnd )
	{
		SetTime(m_nOldBeginTime, m_nOldEndTime);
	}
	else
	{
		m_nOldBeginTime = nBegin;
		m_nOldEndTime = nEnd;
	}

	ReDrawListData(m_strCondition, m_stkCode, m_nOldBeginTime, m_nOldEndTime);
	*pResult = 0;
}
Example #16
0
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;
}
Example #17
0
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 ;    
}
Example #18
0
void DealerHistoryLog::GetFileName(CString &filename)
{
	int nYear;
    int nMonth; 
    int nDay; 
	CString strTime;

	CTime tTime = CTime::GetCurrentTime();
	nDay   = tTime.GetDay();
    nMonth = tTime.GetMonth();
	nYear  = tTime.GetYear();

	char tmp[1024];
	const int pos=GetModuleFileName(NULL,tmp,1024);
	int nPos = pos;			//convert the const int into int!

	while (pos)
	{
		nPos--;
		if ( tmp[nPos] == '\\')
			break;
	}
	tmp[nPos] = '\0';
	filename= (CString)tmp;
	strTime.Format("\\%d%d%d.his", nYear, nMonth, nDay);
	filename += strTime;
}
/**********************************************************
* 函数名:
* 功能 : 写跟踪日志,用于跟踪程序流程
* 入口参数: buf--日志内容,字符串格式
			nValue--参数,可选
* 出口参数: 
* 返回值: 
* 备注: 
***********************************************************/
void CFileManage::WriteTraceLog(const char *szFileName, const char *buf, int nValue)
{
	FILE *fp;
	char filePath[200] = {0};
	char szTmp[200] = {0};

	CTime currentTime = CTime::GetCurrentTime();
	int nYear = currentTime.GetYear();
	int nMonth = currentTime.GetMonth();
	int nDay = currentTime.GetDay();
	int nHour = currentTime.GetHour();
	int nMinute = currentTime.GetMinute();
	int nSecond = currentTime.GetSecond();


	strcat(szTmp, szFileName);
	strcat(szTmp, "%04d%02d%02d.log");

	sprintf(filePath,szTmp,nYear,nMonth,nDay);
	fp=fopen(filePath,"at");
	if (fp == NULL)
	{
		if((fp = fopen(filePath, "wt") ) == NULL)//没有就新建一件文件
		{
			return;
		}
	}			

	fprintf(fp,"%02d:%02d:%02d %s: %d\n",nHour,nMinute,nSecond,buf,nValue);

	fclose(fp);
}
Example #20
0
BOOL CPropShowTime::OnInitDialog()
{
	CPropertyPage::OnInitDialog();

	// TODO:  在此添加额外的初始化
	CTime currentTime;
	currentTime = CTime::GetCurrentTime();
	CString time;
	time.Format(_T("%d年%d月%d日 %d时%d分%d秒"),
		currentTime.GetYear(),currentTime.GetMonth(),currentTime.GetDay(),
		currentTime.GetHour(),currentTime.GetMinute(),currentTime.GetSecond());
	m_com_timeStyle.AddString(time);
	time = currentTime.Format(_T("%Y-%m-%d"));
	m_com_timeStyle.AddString(time);
	time = currentTime.Format(_T("%H:%M:%S"));
	m_com_timeStyle.AddString(time);
	time = currentTime.Format(_T("%Y-%m-%d %H:%M:%S"));
	m_com_timeStyle.AddString(time);
	//初始化
	InitFont();

	SetTimer(ShowTime,1000,NULL);
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Example #21
0
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());
}
CString CProducePacket::ExChangeTime(const CTime& time)
{
	CString wStrTime;
	wStrTime.Format(_T("%d-%d-%d %d:%d:%d"),time.GetYear(),time.GetMonth(),
		time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
	return wStrTime;
}
Example #23
0
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;
}
Example #24
0
CString TimeToString(CTime Time)
{
	CString strTime = _T("");
	strTime.Format("%d-%d-%d %d:%d:%d", Time.GetYear(), Time.GetMonth(), 
        Time.GetDay(), Time.GetHour(), Time.GetMinute(), Time.GetSecond());
	return strTime;
}
Example #25
0
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;
}
Example #26
0
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;
}
Example #27
0
void CLogViewDlg::DoFileSaveCmd()
{
    if(m_LogList.GetItemCount() <= 0)
        return;

    CTime curTime = CTime::GetCurrentTime();
    CString strPathName;
    strPathName.Format(_T("XLog_%04d_%02d_%02d_%02d_%02d_%02d"),
        curTime.GetYear(),
        curTime.GetMonth(),
        curTime.GetDay(),
        curTime.GetHour(),
        curTime.GetMinute(),
        curTime.GetSecond());

    CFileDialog Dlg(FALSE);
    Dlg.m_ofn.lpstrFilter = _T("XLog\0*.xlog\0");
    Dlg.m_ofn.lpstrFile = strPathName.GetBuffer(MAX_PATH);
    if(Dlg.DoModal() == IDOK)
    {
        strPathName.ReleaseBuffer();
        strPathName = Dlg.GetPathName();
        if(strPathName.Find(_T(".")) == -1)
        {
            strPathName += _T(".xlog");
        }

        if(!XSaveLogFile(strPathName, ListViewQueryLogCallback, (void*)&m_vctLogInfo))
        {
            AfxMessageBox(_T("Failed to Save File.\r\nCheck if the file is valid?"), MB_OK | MB_ICONWARNING);
        }
    }
    strPathName.ReleaseBuffer();
}
Example #28
0
CDate::CDate(CTime& t)
{
	m_day = t.GetDay();
	m_month = t.GetMonth();
	m_year = t.GetYear();
	m_xmlname = "date";
}
Example #29
0
File: alarm.cpp Project: bugou/test
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);
}
Example #30
0
BOOL CEventReport::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
  pComboBoxDIVISION = (CComboBox *)GetDlgItem(EVENTREPORT_DIVISION);
  pDTPickerDATE = (CDTPicker *)GetDlgItem(EVENTREPORT_DATE);
  pButtonREPORTTIME = (CButton *)GetDlgItem(EVENTREPORT_REPORTTIME);
  pButtonSTARTOFPIECETRAVEL = (CButton *)GetDlgItem(EVENTREPORT_STARTOFPIECETRAVEL);
  pButtonSTARTOFPIECE = (CButton *)GetDlgItem(EVENTREPORT_STARTOFPIECE);
  pButtonENDOFPIECETRAVEL = (CButton *)GetDlgItem(EVENTREPORT_ENDOFPIECETRAVEL);
  pButtonENDOFPIECE = (CButton *)GetDlgItem(EVENTREPORT_ENDOFPIECE);
  pButtonEXTRABOARD = (CButton *)GetDlgItem(EVENTREPORT_EXTRABOARD);

//
//  Set up the division list
//
  if((SetUpDivisionList(this->m_hWnd, EVENTREPORT_DIVISION, m_DivisionRecordID)) == 0)
  {
    OnCancel();
    return TRUE;
  }
//
//  Set today's date on the Date and Time picker
//
  COleVariant v;
  long day;
  long month;
  long year;

  CTime time = CTime::GetCurrentTime();
  day = time.GetDay();
  month = time.GetMonth();
  year = time.GetYear();

  v = year;
  pDTPickerDATE->SetYear(v);
  v = month;
  pDTPickerDATE->SetMonth(v);
  v = day;
  pDTPickerDATE->SetDay(v);

  m_pPassedData->todaysDate = year * 10000 + month * 100 + day;
//
//  Default everything to checked
//
  pButtonREPORTTIME->SetCheck(TRUE);
  pButtonSTARTOFPIECETRAVEL->SetCheck(TRUE);
  pButtonSTARTOFPIECE->SetCheck(TRUE);
  pButtonENDOFPIECE->SetCheck(TRUE);
  pButtonENDOFPIECETRAVEL->SetCheck(TRUE);
  pButtonEXTRABOARD->SetCheck(TRUE);
//
//  Done
//
  ReleaseCapture();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}