Ejemplo n.º 1
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;
}
Ejemplo n.º 2
0
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
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 5
0
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);
	}
}
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
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;
}
Ejemplo n.º 8
0
Archivo: alarm.cpp Proyecto: 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);
}
Ejemplo n.º 9
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 ;    
}
Ejemplo n.º 10
0
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();
}
Ejemplo n.º 11
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());
}
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);
		}
	}
}
Ejemplo n.º 13
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;
}
Ejemplo n.º 14
0
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);
}
Ejemplo n.º 15
0
/*
* 打印日志文件
*/
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);
}
Ejemplo n.º 16
0
/**********************************************************
* 函数名:
* 功能 : 写跟踪日志,用于跟踪程序流程
* 入口参数: 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);
}
Ejemplo n.º 17
0
void CMainFrame::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	switch(nIDEvent)
	{
	case AUTOSHUTDOWN:
		CTime currTime = CTime::GetCurrentTime();
		if(theApp.m_logicVariables.IsAutoCloseComputer)
		{
			CString strCurrtime;
			strCurrtime.Format(_T("%d:%d:%d"),currTime.GetHour(),currTime.GetMinute(),
				currTime.GetSecond());
			CString strCloseComputerTime;
			strCloseComputerTime.Format(_T("%d:%d:%d"),theApp.m_logicVariables.CloseComputerTime.GetHour(),
				theApp.m_logicVariables.CloseComputerTime.GetMinute(),
				theApp.m_logicVariables.CloseComputerTime.GetSecond());
			if(strCurrtime==strCloseComputerTime)
			{
				ShutDown();
			}
		}
		break;
	}
	CFrameWnd::OnTimer(nIDEvent);
}
Ejemplo n.º 18
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;
}
Ejemplo n.º 19
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
}
Ejemplo n.º 20
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;
}
Ejemplo n.º 21
0
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;
}
Ejemplo n.º 22
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();
}
Ejemplo n.º 23
0
NET_TIME CDevByFileDlg::ConvertToDateTime(const COleDateTime &date, const CTime &time)
{
	NET_TIME netTime = {0};
	int year = date.GetYear();
	if (year < 2000)
	{
		netTime.dwYear = 2000;
		netTime.dwMonth = 1;
		netTime.dwDay = 1;
		netTime.dwHour = 0;
		netTime.dwMinute = 0;
		netTime.dwSecond = 0;
	}
	else
	{
		netTime.dwYear = date.GetYear();
		netTime.dwMonth = date.GetMonth();
		netTime.dwDay = date.GetDay();
		netTime.dwHour = time.GetHour();
		netTime.dwMinute = time.GetMinute();
		netTime.dwSecond =time.GetSecond();
	}
	
	return netTime;
}
Ejemplo n.º 24
0
void CHallQueFrontView::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	switch(nIDEvent)
	{
	case FORSHOWTIME:
		{
			int count = m_pTrackCtrl->m_selTrackerAll.GetCount();
			CString time;
			CTime currentTime;
			currentTime = CTime::GetCurrentTime();
			for(int i=0;i<count;i++)
			{
				if(enmStatic==m_pTrackCtrl->m_selTrackerAll[i]->GetWindowType())
				{
					if(m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic
						->GetIsShowTime())
					{
						switch(m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic
							->GetTimeFormat())
						{
						case enumTimeChinese:
							time.Format(_T("%d年%d月%d日 %d时%d分%d秒"),
								currentTime.GetYear(),currentTime.GetMonth(),currentTime.GetDay(),
								currentTime.GetHour(),currentTime.GetMinute(),currentTime.GetSecond());
							break;
						case enumTimeYearMonthDay:
							time = currentTime.Format(_T("%Y-%m-%d"));
							break;
						case enumTimeHourMinSec:
							time = currentTime.Format(_T("%H:%M:%S"));
							break;
						case enumTimeYMDHMS:
							time = currentTime.Format(_T("%Y-%m-%d %H:%M:%S"));
							break;
						}
						m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->
							SetWindowText(time);
						m_pTrackCtrl->m_selTrackerAll[i]->m_pTransStatic->
							Invalidate(TRUE);
					}
				}
			}
		}
		break;
	case WORKTIME:
		JudgeButtonWorkOut();//判断队列工作时间
		theApp.m_Controller.ClearSystemData();//判断清空系统排队数据时间
		break;
	case DOINITThROUGHSCREEN:
		{
			SLZCWndScreen* pWndScreen = SLZCWndScreen::GetInstance();
//			pWndScreen->DoThroughInitMsg();
			KillTimer(DOINITThROUGHSCREEN);
		}
		break;
	}
	CView::OnTimer(nIDEvent);
}
Ejemplo n.º 25
0
//////////////////////////////////////////////////////////////////////////
//时间与字符串互相转换函数
ATL::CString GlobeFuns::TimeToString(const CTime &t)
{
	ATL::CString strDateTime;
	strDateTime.Format("%d-%02d-%02d %02d:%02d:%02d", 
		t.GetYear(), t.GetMonth(), t.GetDay(),
		t.GetHour(), t.GetMinute(), t.GetSecond());
	return strDateTime;
}
Ejemplo n.º 26
0
CString GetLogTimeStamp()
{
    CTime tm = CTime::GetCurrentTime();
    CString szTime;
    szTime.Format(_T("%.4d%.2d%.2d-%.2d%.2d%.2d"), tm.GetYear(), tm.GetMonth(),
                  tm.GetDay(), tm.GetHour(), tm.GetMinute(), tm.GetSecond());
    return szTime;
}
Ejemplo n.º 27
0
void CXTaskDlg::CheckForUpdate()
{
	CXsvrDlg *pDlg = (CXsvrDlg*)AfxGetMainWnd();

	CTime today;
	today = CTime::GetCurrentTime();
	CString strNow = today.Format(_T("%Y-%m-%d %H:%M:%S"));

	char *buf = (LPSTR)(LPCTSTR)strNow;
	XTask task;
	task.SetDate(buf);
	task.SetTime(buf);

	list<XTask*>::iterator iLast = m_listTask.end();
	for (list<XTask*>::iterator iTask = m_listTask.begin();
		iTask != iLast;)
	{
		// 是时候执行任务了。
		if ( (task.nDate > (*iTask)->nDate)
			| ((task.nDate == (*iTask)->nDate)&&task.nTime >= (*iTask)->nTime))
		{
			// 日期已过
			pDlg->AddErrorInfo((*iTask)->szContent);

			XTask *p = (*iTask);
			m_listTask.remove(*iTask++);

			SendTask(p->nID, p->szContent);
			DeleteTask(p->nID);

			if (p->nFrequency == 0)
			{
				CTime timeTomorrow(today.GetYear(),
					today.GetMonth(),
					today.GetDay()+1,
					today.GetHour(),
					today.GetMinute(),
					today.GetSecond());
				CString strTomorrow = timeTomorrow.Format(_T("%Y-%m-%d %H:%M:%S"));
				AddNewTask(strTomorrow, p->szContent, 0);
				pDlg->AddErrorInfo(strTomorrow);
			}
			else
			{
				DeleteReceiver(p->nID);
			}

			delete p;
		}
		else
		{
			++ iTask;
		}
	}

	// 任务完成后,重新启动计时器
	SetTimer(TIMER_SCAN_DATABASE, TIMER_SCAN_DATABASE_TEIM, NULL);
}
Ejemplo n.º 28
0
Archivo: Date.cpp Proyecto: smc314/SLib
void Date::SetValue(const CTime& ct)
{
	Year(ct.GetYear());
	Month(ct.GetMonth());
	Day(ct.GetDay());
	Hour(ct.GetHour());
	Min(ct.GetMinute());
	Sec(ct.GetSecond());
}
Ejemplo n.º 29
0
void CRelaxReminderDlg::AutoSaveStatistics()
{
    // 每10分钟自动保存统计量到ini文件中
    CTime timeAutoSave = CTime::GetCurrentTime();
    if (timeAutoSave.GetMinute() % 10 == 0 && timeAutoSave.GetSecond() == 0)
    {
        SaveStatisticsToIniFile();
    }
}
Ejemplo n.º 30
0
void CChatWnd::AddTimestamp()
{
    if ( Settings.Community.Timestamp )
    {
        CTime tNow = CTime::GetCurrentTime();
        CString str;
        str.Format( _T("[%.2i:%.2i:%.2i] "), tNow.GetHour(), tNow.GetMinute(), tNow.GetSecond() );
        m_pContent.Add( retText, str, NULL, retfColour )->m_cColour = CoolInterface.m_crChatNull;
    }
}