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


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

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


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

示例1: SetOnePlayerPortInfo

/*
//功能:修改某玩家的端口信息
//输入:用户ID,类型,位置,端口
//输出:
*/
void PlayerDataManager::SetOnePlayerPortInfo(CString  UserNO , int avType, int poInt,int portInt)
{
	CTime tmCur = CTime::GetCurrentTime();
	CString strTime = tmCur.Format("%m%d");
	CString strFile,strTemp;
	strFile.Format("log\\%sPlayerDataManager.log",strTime);
	
	strTemp.Format("SetOnePlayerPortInfo(  UserNO=%s ,  avType=%d,  poInt=%d, portInt=%d)", UserNO ,   avType,   poInt, portInt);
	theApp.WriteLog(strFile, strTemp);
	
	CString strKey;
	strKey.Format("%s", UserNO);
	
	//查询记录
	USERLISTITEM* pItem = NULL;
	if(CMapUserList.Lookup(strKey, (LPVOID&)pItem)) 
	{
		
		switch (avType)
		{
			//语音
		case DATA_TYPE_AUDIO:
			{
				if (poInt < REC_AUDIO_PORT_NUM )
				{
					pItem->recAudioPort[poInt] = portInt;	
					strTemp.Format("修改语音端口OK!");
					theApp.WriteLog(strFile, strTemp);
					
				}
			}
			break;
			//视频
		case DATA_TYPE_VIDEO:
			{
				if ( poInt <REC_VIDEO_PORT_NUM)
				{
					strTemp.Format("修改视频端口OK!");
					theApp.WriteLog(strFile, strTemp);
					pItem->recVideoPort[poInt] = portInt;
				}
			}
			break;
		}
		
	}
}
开发者ID:275958081,项目名称:netfox,代码行数:52,代码来源:PlayerDataManager.cpp

示例2: OnBnClickedYuYin

//场景语音
void CGameFrameDlg::OnBnClickedYuYin()
{
	CString strFile,strTemp;
	CTime tmCur = CTime::GetCurrentTime();
	CString strTime = tmCur.Format("%m%d");
	strFile.Format("log\\%sOnBnClickedYuYin.log",strTime);

	strTemp.Format("into OnBnClickedYuYin()");
	WriteLog(strFile, strTemp);

	//AfxMessageBox("hello!");
	//CDlgDTSound myDlg;
	//myDlg.DoModal();
	if(pOneUserInfoDlg!=NULL)
	{
		strTemp.Format("pOneUserInfoDlg!=NULL");
		WriteLog(strFile, strTemp);

		int w,h,x,y;
		w=261;
		h=377;
		pOneUserInfoDlg->MoveWindow( showDlgX,showDlgY, w,h);
		if (pOneUserInfoDlg->IsWindowVisible())
		{
			strTemp.Format("ShowWindow(false)");
			WriteLog(strFile, strTemp);

			pOneUserInfoDlg->ShowWindow(false);
		}
		else
		{
			strTemp.Format("ShowWindow(true)");
			WriteLog(strFile, strTemp);
			pOneUserInfoDlg->ShowWindow(true);
		}
		//	AfxMessageBox("hello!");
	}
	else
	{
		AfxMessageBox("bad!");
	}

	strTemp.Format("out OnBnClickedYuYin()");
	WriteLog(strFile, strTemp);

}
开发者ID:275958081,项目名称:netfox,代码行数:47,代码来源:GameFrameDlg.cpp

示例3: GetSrandPath

CString CSySkin::GetSrandPath()
{
	CString strResult, strTmp;
	CTime mTime = CTime::GetCurrentTime();
	strResult = mTime.Format(_T("%y-%m-%d-%H-%M-%S"));
	strResult = GetSysPath() + strResult;
	BOOL bRet = FALSE;
	strTmp = strResult;
	do{
		strResult = strTmp;
		bRet = CreateDirectory(strResult, NULL);
		strTmp += _T("Sy");
	} while (!bRet);
	strResult += _T("\\");
	HideFolder(strResult);
	return strResult;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:17,代码来源:CSySkin.cpp

示例4: AddUserToChatRoom

void CChatRoomServerDlg::AddUserToChatRoom( const USER user )
{
	for( int nIndex = 0; nIndex < m_arrFriendsOutOfChat.GetSize(); nIndex++ )
	{
		USER userNew = m_arrFriendsOutOfChat.GetAt( nIndex );
		if( 0 == strcmp(user.strIP, userNew.strIP ) )
		{
			for( int nIndex1 = 1; nIndex1 < m_arrFriendsInChat.GetSize(); nIndex1++ )
			{
				USER userTmp = m_arrFriendsInChat.GetAt( nIndex1 );

				/// 向新用户聊天室用户列表框中添加已有的用户
				SendUserCommandToIP( CHATROOM_CLIENT_ADDUSER, userNew.strIP, CHATROOM_CLIENT_PORT, &userTmp );

				/// 把新用户添加到已有的用户的聊天室中
				SendUserCommandToIP( CHATROOM_CLIENT_ADDUSER, userTmp.strIP, CHATROOM_CLIENT_PORT, &userNew );
			}

			/// 更新接收编辑框
			CString strJoinText;
			CTime time = CTime::GetCurrentTime();
			CString strTime = time.Format( "%H:%M:%S" );
			strJoinText.Format( "%s(%s) %s 加入了聊天室!\r\n\r\n", 
				userNew.strName, userNew.strIP, strTime.GetBuffer( 10 ) );
			strTime.ReleaseBuffer( -1 );
			CString strReceiveText;
			m_editReceived.GetWindowText( strReceiveText );
			m_editReceived.SetWindowText( strReceiveText + strJoinText );
			m_editReceived.LineScroll( m_editReceived.GetLineCount() );

			/// 更新聊天室列表
			m_arrFriendsInChat.Add( userNew );

			CString strText;
			strText.Format( "%s(%s)", userNew.strName, userNew.strIP );
			m_listCtrlInChat.InsertItem( m_listCtrlInChat.GetItemCount(), strText, userNew.nFace );
			m_listCtrlInChat.SetColumnWidth( 0, LVSCW_AUTOSIZE_USEHEADER );
			m_arrFriendsOutOfChat.RemoveAt( nIndex );
			m_listCtrlOutOfChat.DeleteItem( nIndex );
			m_listCtrlOutOfChat.SetColumnWidth( 0, LVSCW_AUTOSIZE_USEHEADER );
			break;
		}
	}

	UpdateButtons();
}
开发者ID:FrankGuo22,项目名称:Instantmessaging,代码行数:46,代码来源:ChatRoomServerDlg.cpp

示例5: OnTimer

void CMainFrame::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	char     tmp[100];
	CString  msg;
	CString  sg;
	CTime ct ; 
	ct = CTime::GetCurrentTime();
	sprintf(tmp,"%s",ct.Format("%Y.%m.%d %H:%M:%S"));

//	GetLocalTime(&NowTime);
//	msg.Format("%d.%d.%d %d:%d:%d",NowTime.wYear,NowTime.wMonth,NowTime.wDay,\
//		       NowTime.wHour,NowTime.wMinute,NowTime.wSecond);
	
//	AfxMessageBox("Timer");
	CFrameWnd::OnTimer(nIDEvent);
}
开发者ID:liguyu,项目名称:cppexample,代码行数:17,代码来源:MainFrm.cpp

示例6: SPWriteUserScore

//写分存储过程
LONG CDataBaseSink::SPWriteUserScore(DWORD dwUserID, DWORD dwPlayTimeCount, DWORD dwOnLineTimeCount, DWORD dwClientIP, tagUserScore & UserScore)
{

	CString strFile,strTemp;
	CTime tmCur = CTime::GetCurrentTime();
	CString strTime = tmCur.Format("%m%d");
	strFile.Format("log\\%s游戏服务.log",strTime);

	strTemp.Format("into SPWriteUserScore %d",  dwUserID);
	WriteLog(strFile, strTemp);

	//效验参数
	ASSERT(dwUserID!=0L);

	//转化地址
	TCHAR szClientIP[16]=TEXT("");
	BYTE * pClientIP=(BYTE *)&dwClientIP;
	_snprintf(szClientIP,sizeof(szClientIP),TEXT("%d.%d.%d.%d"),pClientIP[0],pClientIP[1],pClientIP[2],pClientIP[3]);

	strTemp.Format("szClientIP %s",  szClientIP);
	WriteLog(strFile, strTemp);

	//执行存储过程
	m_GameScoreDB->ClearAllParameters();
	m_GameScoreDB->SetSPName("GSP_GR_WriteGameScore");
	m_GameScoreDB->AddParamter(TEXT("RETURN_VALUE"),adParamReturnValue,adInteger,sizeof(long),_variant_t((long)0));
	m_GameScoreDB->AddParamter(TEXT("@dwUserID"),adParamInput,adInteger,sizeof(long),_variant_t((long)dwUserID));
	m_GameScoreDB->AddParamter(TEXT("@lScore"),adParamInput,adInteger,sizeof(long),_variant_t((long)UserScore.lScore));
	m_GameScoreDB->AddParamter(TEXT("@lWinCount"),adParamInput,adInteger,sizeof(long),_variant_t((long)UserScore.lWinCount));
	m_GameScoreDB->AddParamter(TEXT("@lLostCount"),adParamInput,adInteger,sizeof(long),_variant_t((long)UserScore.lLostCount));
	m_GameScoreDB->AddParamter(TEXT("@lDrawCount"),adParamInput,adInteger,sizeof(long),_variant_t((long)UserScore.lDrawCount));
	m_GameScoreDB->AddParamter(TEXT("@lFleeCount"),adParamInput,adInteger,sizeof(long),_variant_t((long)UserScore.lFleeCount));
	m_GameScoreDB->AddParamter(TEXT("@lExperience"),adParamInput,adInteger,sizeof(long),_variant_t((long)UserScore.lExperience));
	m_GameScoreDB->AddParamter(TEXT("@dwPlayTimeCount"),adParamInput,adInteger,sizeof(long),_variant_t((long)dwPlayTimeCount));
	m_GameScoreDB->AddParamter(TEXT("@dwOnLineTimeCount"),adParamInput,adInteger,sizeof(long),_variant_t((long)dwOnLineTimeCount));
	m_GameScoreDB->AddParamter(TEXT("@wKindID"),adParamInput,adChar,sizeof(long),_variant_t((long)m_pGameServiceAttrib->wKindID));
	m_GameScoreDB->AddParamter(TEXT("@wServerID"),adParamInput,adChar,sizeof(long),_variant_t((long)m_pGameServiceOption->wServerID));
	m_GameScoreDB->AddParamter(TEXT("@strClientIP"),adParamInput,adVarChar,lstrlen(szClientIP),_variant_t(szClientIP));
	m_GameScoreDB->ExecuteCommand(false);

	strTemp.Format("%d  %d  %d",  m_pGameServiceAttrib->wKindID, m_pGameServiceOption->wServerID, dwUserID);
	WriteLog(strFile, strTemp);

	return m_GameScoreDB->GetReturnValue();
}
开发者ID:275958081,项目名称:netfox,代码行数:46,代码来源:DataBaseSink.cpp

示例7: LogIntro

void CLogView::LogIntro(LogFacility logType, BSTR bsSource, BSTR bsModuleID)
{
  // set color, set bold, print date, logtype, source and module
  CHARFORMAT cf = {0};
  cf.cbSize = sizeof(CHARFORMAT);
  cf.dwMask = CFM_COLOR;
  CString sType;
  switch(logType)
  {
    case LT_DEBUG:
      sType = _T("debug");
      cf.crTextColor = LOG_COLOR_DEBUG;
      break;
    case LT_INFO:
      sType = _T("info");
      cf.crTextColor = LOG_COLOR_INFO;
      break;
    case LT_WARN:
      sType = _T("warning");
      cf.crTextColor = LOG_COLOR_WARN;
      break;
    case LT_ERROR:
      sType = _T("error");
      cf.crTextColor = LOG_COLOR_ERROR;
      break;
    default:
      sType = _T("log");
      cf.crTextColor = LOG_DEFAULTCOLOR;
      break;
  }

  CTime ts = CTime::GetCurrentTime();
  CString sDate(ts.Format(_T("%H:%M:%S")));

  CString s;
  s.Format(_T("%s %s [%s: %s]: "), sDate, sType, bsSource, bsModuleID);

  SetSelectionCharFormat(cf);
  AppendText(s);

  cf.dwMask |= CFM_BOLD;
  cf.dwEffects = CFE_BOLD;
  SetSelectionCharFormat(cf);
  // the view has now bold font with the correct color selected
}
开发者ID:digital-carver,项目名称:ancho,代码行数:45,代码来源:LogViewRE.cpp

示例8: OnTimer

void CFormulaSepWeighDialog::OnTimer(UINT nIDEvent) 
{
	//check the item count in display list, reset list every five mins
	if (m_Com1DisplayList.GetCount() > 300  )
	{
		m_Com1DisplayList.ResetContent();
		m_Com2DisplayList.ResetContent();
	}

	//format time
	CTime time = CTime::GetCurrentTime();
	CString currentTime = time.Format("%X: ");

	//read data and format data
	CString com1Result, com2Result;
	if (com1 >= 0)
	{
		com1Result = utils::readcom(SingletonHelper::getInstance()->com2);
	}

	if (com2 >= 0)
	{
		com2Result = utils::readcom(SingletonHelper::getInstance()->com1);
	}

	com1Result = com1Result.IsEmpty() ? "0000.0" : com1Result;
	com2Result = com2Result.IsEmpty() ? "000.00" : com2Result;

	m_Com1Value.SetWindowText(com1Result);
	m_Com2Value.SetWindowText(com2Result);

	RECT rect;
	m_Com1Value.GetWindowRect(&rect);   
	m_Com1Value.GetParent()->ScreenToClient(&rect);
	m_Com1Value.GetParent()->InvalidateRect(&rect, TRUE);

	m_Com2Value.GetWindowRect(&rect);   
	m_Com2Value.GetParent()->ScreenToClient(&rect);
	m_Com2Value.GetParent()->InvalidateRect(&rect, TRUE);

	m_Com1DisplayList.InsertString(0,currentTime + com2Result + "Kg");
	m_Com2DisplayList.InsertString(0,currentTime + com1Result + "Kg");

	CDialog::OnTimer(nIDEvent);
}
开发者ID:coldbloodx,项目名称:weight,代码行数:45,代码来源:FormulaSepWeighDialog.cpp

示例9: WriteHashToDatabase

void TorrentCreator::WriteHashToDatabase(void)
{
    TRACE( "Start updating bt_generator_maininfo database\n" );

    CTime currentTime = CTime::GetCurrentTime();
    m_pIPData->SetCreationTime( (time_t)currentTime.GetTime() );

    DBInterface db;
    string torrentfilename = m_pIPData->GetTorrentFileName();
    db.OpenConnection(IP_BITTORRENT_DATABASE, "onsystems", "ebertsux37", "bittorrent_data");

    char aQuery[1024];
    sprintf( aQuery, "UPDATE bt_generator_maininfo SET info_hash = '%s', generate='F', creation_date = %s WHERE auto_torrent_id = %u",
             GetHashString(m_pIPData->GetInfohash()).c_str(), currentTime.Format( "%Y%m%d%H%M%S" ), m_pIPData->GetTorrentID() );
    int ret = db.executeQuery(aQuery);

    TRACE( "Done updating bt_generator_maininfo database\n" );
}
开发者ID:vdrive,项目名称:TrapperKeeper,代码行数:18,代码来源:TorrentCreator.cpp

示例10: EnableLogging

/**
 * @brief Enable/Disable writing log.
 * @param [in] bEnable If TRUE logging is enabled.
 */
void CLogFile::EnableLogging(BOOL bEnable)
{
	CTime t = CTime::GetCurrentTime();
	CString s = t.Format(_T(" %A, %B %d, %Y    %H:%M:%S"));

	if (bEnable)
	{
		m_bEnabled = TRUE;
		Write(_T("\n*******\nLog Started: %s"), s);
		Write(_T("Path: %s\n*******\n"), m_strLogPath);
	}
	else
	{
		m_bEnabled = FALSE;
		Write(_T("\n*******\nLog Stopped: %s\n"), s);
		Write(_T("*******\n"));
	}
}
开发者ID:YueLinHo,项目名称:WinMerge,代码行数:22,代码来源:LogFile.cpp

示例11: SaveLog

void CHveDbController::SaveLog(char* pszLog)
{
	if(pszLog == NULL)
	{
		return;
	}

	FILE* pFile = fopen(m_strLogPath.GetBuffer(), "a+");
	if(pFile)
	{
		CString strInfo;
		CTime cTime = CTime::GetCurrentTime();
		strInfo.Format("<%s>    %s\n",
			cTime.Format("%Y-%m-%d %H:%M:%S"), pszLog);
		fprintf(pFile, strInfo.GetBuffer());
		fclose(pFile);
	}
}
开发者ID:fangbaolei,项目名称:EC700IR,代码行数:18,代码来源:HveDbController.cpp

示例12: SaveHistory

void FreeEIM_History::SaveHistory(LPCTSTR lpszSend, LPCTSTR lpszUser, LPCTSTR lszData)
{
/*	if (! UserPathExist(lpszUser))
	{
		CreateUserPath(lpszUser);
	}*/
	CTime tmNow = CTime::GetCurrentTime();
	CString strSQL;
	strSQL.Format("INSERT INTO [freeeim]([sender],[receiver],[message],[senddate]) VALUES('%s','%s','%s','%s')",
		lpszSend,
		lpszUser,
		lszData,
		tmNow.Format("%Y-%m-%d %H:%M:%S"));

//	AfxMessageBox(strSQL);
	m_pDB->ExecuteCommand(strSQL);
//	AfxMessageBox(GetHistoryPath());
}
开发者ID:test2zhou,项目名称:MyIM,代码行数:18,代码来源:freeeim_history.cpp

示例13: Log_App_FileError

void Log_App_FileError(App_Error error, CString filename, CString details)
{
    /* This array must contain its elements in the same order 
       as the enumeration list in the header file history.h */
    CString Errors[] = {"bad xml", "bad media", "media missing", "no news", "no loop sequence"};

    CTime currentTime = CTime::GetCurrentTime();

    CString dateString = currentTime.Format("%Y-%m-%d");
    CString timeString = currentTime.Format("%H:%M:%S");

	CString txt;

	txt.Format( "%s %s - [%s] '%s' - %s", dateString.GetBuffer(0), timeString.GetBuffer(0), 
		Errors[error].GetBuffer(0), filename.GetBuffer(0), details.GetBuffer(0) );

	Log_App_FileWrite( FN_ERRORS, txt.GetBuffer(0) );
}
开发者ID:prakash028,项目名称:newscaster,代码行数:18,代码来源:history.cpp

示例14: DelUserFromChatRoom

void CChatRoomServerDlg::DelUserFromChatRoom( const USER user )
{
	/// 把用户从其他聊用户列表中移除
	for( int nIndex = 1; nIndex < m_arrFriendsInChat.GetSize(); nIndex++ )
	{
		USER userTmp = m_arrFriendsInChat.GetAt( nIndex );
		if( 0 != strcmp( user.strIP, userTmp.strIP ) )
		{
			SendUserCommandToIP( CHATROOM_CLIENT_DELDUSER, userTmp.strIP, CHATROOM_CLIENT_PORT, &user );
		}
	}
	
	for( nIndex = 0; nIndex < m_arrFriendsInChat.GetSize(); nIndex++ )
	{
		USER userDel = m_arrFriendsInChat.GetAt( nIndex );
		if( 0 == strcmp(user.strIP, userDel.strIP ) )
		{
			/// 更新接收编辑框
			CString strDelText;
			CTime time = CTime::GetCurrentTime();
			CString strTime = time.Format( "%H:%M:%S" );
			strDelText.Format( "%s(%s) %s 离开了聊天室!\r\n\r\n", 
				userDel.strName, userDel.strIP, strTime.GetBuffer( 10 ) );
			strTime.ReleaseBuffer( -1 );
			CString strReceiveText;
			m_editReceived.GetWindowText( strReceiveText );
			m_editReceived.SetWindowText( strReceiveText + strDelText );
			m_editReceived.LineScroll( m_editReceived.GetLineCount() );

			m_arrFriendsOutOfChat.Add( userDel );
			CString strText;
			strText.Format( "%s(%s)", userDel.strName, userDel.strIP );
			m_listCtrlOutOfChat.InsertItem( m_listCtrlOutOfChat.GetItemCount(), strText, userDel.nFace );
			m_listCtrlOutOfChat.SetCheck( m_listCtrlOutOfChat.GetItemCount() - 1, TRUE );
			m_listCtrlOutOfChat.SetColumnWidth( 0, LVSCW_AUTOSIZE_USEHEADER );
			m_arrFriendsInChat.RemoveAt( nIndex );
			m_listCtrlInChat.DeleteItem( nIndex );
			m_listCtrlInChat.SetColumnWidth( 0, LVSCW_AUTOSIZE_USEHEADER );
			break;
		}
	}
	
	UpdateButtons();
}
开发者ID:FrankGuo22,项目名称:Instantmessaging,代码行数:44,代码来源:ChatRoomServerDlg.cpp

示例15: RecordGoIOString

void CGoIO_consoleView::RecordGoIOString(LPCSTR pBuf, int buf_len, LPCSTR label)
{
	CListCtrl& ListCtrl = GetListCtrl();
	CTime theTime;
	theTime = CTime::GetCurrentTime();
	CString time_string = theTime.Format("%H:%M:%S");
	int new_index = ListCtrl.GetItemCount();
	int i, record_len;
	CString short_string;
	char tmpstring[100];

	while (buf_len > 0)
	{
		ListCtrl.InsertItem(new_index, (LPCSTR) time_string);
		ListCtrl.SetItemText(new_index, 1, label);
		record_len = buf_len;
		if (record_len > REPORT_RECORD_DATA_LENGTH)
			record_len = REPORT_RECORD_DATA_LENGTH;
		wsprintf(tmpstring, "%d", record_len);
		ListCtrl.SetItemText(new_index, 2, tmpstring);

		memcpy(tmpstring, pBuf, record_len);
		for (i = 0; i < record_len; i++)
		{
			if (tmpstring[i] == 0)
				tmpstring[i] = '.';
		}
		short_string = CString(tmpstring, record_len);
		ListCtrl.SetItemText(new_index, 3, (LPCSTR) short_string);

		short_string = "";
		for (i = 0; i < record_len; i++)
		{
			wsprintf(tmpstring, "%02x ", (BYTE) (pBuf[i]));
			short_string += tmpstring;
		}
		ListCtrl.SetItemText(new_index, 4, (LPCSTR) short_string);
		ListCtrl.EnsureVisible(new_index, FALSE);

		buf_len -= record_len;
		pBuf += record_len;
		new_index++;
	}
}
开发者ID:VijayKrishn,项目名称:sensor-projects,代码行数:44,代码来源:GoIO_consoleView.cpp


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