本文整理汇总了C++中CTime::GetHour方法的典型用法代码示例。如果您正苦于以下问题:C++ CTime::GetHour方法的具体用法?C++ CTime::GetHour怎么用?C++ CTime::GetHour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTime
的用法示例。
在下文中一共展示了CTime::GetHour方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitInstance
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
// Set up the highest resolution timer we can manage
// TIMECAPS tc;
// UINT nPeriod;
// if( TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)) )
// nPeriod = tc.wPeriodMin;
// else
// nPeriod = 1;
// timeBeginPeriod( nPeriod );
HWND hWnd;
g_hMainWnd = hWnd = CreateWindow(g_szWindowClass, g_szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
int x = 480, y = 0;
SetWindowPos( hWnd, NULL, x, y, 800, 416, SWP_SHOWWINDOW );
if (!hWnd)
return FALSE;
SetTimer( g_hMainWnd, 0, SEC( 60 ), NULL ); // 60
SetTimer( g_hMainWnd, 1, MIN( 60 ), NULL ); // 3600
CTime time = CTime::GetCurrentTime();
SetLogInfo( LOGTYPE_TIME, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );
g_GameTimer.SetTime(time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
#ifndef _DEBUG
// #if defined(__MINIDUMP)
// InitDumper( DUMP_LEVEL_0 );
// #else
// InitEH();
// #endif // !__MINIDUMP
#endif // _DEBUG
EnableFloatException();
if( InitializeNetLib() == FALSE )
return FALSE;
if( InitializeScriptLib() == FALSE )
return FALSE;
xSRand( timeGetTime() ); // 속도를 요하는 랜덤은 xRandom()을 쓰도록...
if( Script( g_szINI ) == TRUE )
{
if( !prj.OpenProject( "Masquerade.prj" ) )
{
Error( "OpenProject ERROR check Masquerade.prj" );
return FALSE;
}
SetLogInfo( LOGTYPE_REDRAW, "" );
SetTitle();
if( CompileItemScript( "ItemScript.lua" ) == FALSE )
return FALSE;
#if defined(__REMOVE_SCIRPT_060712)
if( CWorldDialog::GetInstance().Init() == FALSE )
{
OutputDebugString( "WorldDialog.DLL load failed\n" );
return FALSE;
}
#endif
return CRunObject::GetInstance()->Init();
}
else
{
char szBuffer[300] = {0,};
char szDir[255] = {0,};
GetCurrentDirectory( 255, szDir );
sprintf( szBuffer, "%s\\WorldServer.ini File not found", szDir );
AfxMessageBox( szBuffer );
return FALSE;
}
}
示例2: ZoneChange
void CUser::ZoneChange(int zone, float x, float z)
{
m_bZoneChangeFlag = TRUE;
C3DMap* pMap = NULL;
_ZONE_SERVERINFO *pInfo = NULL;
pMap = g_pMain->GetZoneByID(zone);
if (!pMap)
return;
if( pMap->m_bType == 2 ) { // If Target zone is frontier zone.
if( GetLevel() < 20 && g_pMain->m_byBattleOpen != SNOW_BATTLE)
return;
}
if( g_pMain->m_byBattleOpen == NATION_BATTLE ) { // Battle zone open
if( m_pUserData.m_bZone == BATTLE_ZONE ) {
if( pMap->m_bType == 1 && m_pUserData.m_bNation != zone ) { // ???? ?????? ???? ????..
if( m_pUserData.m_bNation == KARUS && !g_pMain->m_byElmoradOpenFlag ) {
TRACE("#### ZoneChange Fail ,,, id=%s, nation=%d, flag=%d\n", m_pUserData.m_id, m_pUserData.m_bNation, g_pMain->m_byElmoradOpenFlag);
return;
}
else if( m_pUserData.m_bNation == ELMORAD && !g_pMain->m_byKarusOpenFlag ) {
TRACE("#### ZoneChange Fail ,,, id=%s, nation=%d, flag=%d\n", m_pUserData.m_id, m_pUserData.m_bNation, g_pMain->m_byKarusOpenFlag);
return;
}
}
}
else if( pMap->m_bType == 1 && m_pUserData.m_bNation != zone ) { // ???? ?????? ???? ????..
return;
}
//
else if( pMap->m_bType == 2 && zone == ZONE_FRONTIER ) { // You can't go to frontier zone when Battlezone is open.
int temp_index = 0;
char temp_buff[3];
SetByte( temp_buff, WIZ_WARP_LIST, temp_index );
SetByte( temp_buff, 2, temp_index );
SetByte( temp_buff,0, temp_index );
Send(temp_buff, temp_index);
//
return;
}
//
}
else if( g_pMain->m_byBattleOpen == SNOW_BATTLE ) { // Snow Battle zone open
if( pMap->m_bType == 1 && m_pUserData.m_bNation != zone ) { // ???? ?????? ???? ????..
return;
}
else if( pMap->m_bType == 2 && (zone == ZONE_FRONTIER || zone == ZONE_BATTLE ) ) { // You can't go to frontier zone when Battlezone is open.
return;
}
}
else { // Battle zone close
if( pMap->m_bType == 1 && m_pUserData.m_bNation != zone && (zone < 10 || zone > 21))
return;
}
m_bWarp = 0x01;
UserInOut(INOUT_OUT);
if( m_pUserData.m_bZone == ZONE_SNOW_BATTLE ) {
//TRACE("ZoneChange - name=%s\n", m_pUserData.m_id);
SetMaxHp( 1 );
}
m_pUserData.m_bZone = zone;
m_pUserData.m_curx = x;
m_pUserData.m_curz = z;
m_pMap = pMap;
if( m_pUserData.m_bZone == ZONE_SNOW_BATTLE ) {
//TRACE("ZoneChange - name=%s\n", m_pUserData.m_id);
SetMaxHp();
}
PartyRemove(GetSocketID()); // ??????? Z?????? ó??
//TRACE("ZoneChange ,,, id=%s, nation=%d, zone=%d, x=%.2f, z=%.2f\n", m_pUserData.m_id, m_pUserData.m_bNation, zone, x, z);
if( g_pMain->m_nServerNo != pMap->m_nServerNo ) {
pInfo = g_pMain->m_ServerArray.GetData( pMap->m_nServerNo );
if( !pInfo )
return;
UserDataSaveToAgent();
CTime t = CTime::GetCurrentTime();
g_pMain->WriteLog("[ZoneChange : %d-%d-%d] - sid=%d, acname=%s, name=%s, zone=%d, x=%d, z=%d \r\n", t.GetHour(), t.GetMinute(), t.GetSecond(), GetSocketID(), m_strAccountID, m_pUserData.m_id, zone, (int)x, (int)z);
m_pUserData.m_bLogout = 2; // server change flag
SendServerChange(pInfo->strServerIP, 2);
return;
}
SetRegion(GetNewRegionX(), GetNewRegionZ());
//.........这里部分代码省略.........
示例3: onRecvProtocol
void CMainDlg::onRecvProtocol( BasicProtocol* p, SOCKET socket)
{
using namespace ROBOT_PROTOCOL;
switch( p->iid_)
{
case RBT_CONFIG_REQ:
{
Robot_Config_Req* req = reinterpret_cast <Robot_Config_Req*>(p);
Robot_Config_Ack* ack = new Robot_Config_Ack();
ack->version_ = ROBOT_VERSION;
OptionUtil::RobotDesctiption* des = g_opt.find_robot_byname( req->robotname_);
if ( des)
{
if ( des->robotpwd_ != req->robotpwd_)
ack->ret_ = -2;
else
{
if ( req->version_ != ROBOT_VERSION)
{
ack->ret_ = -4;
}
else
{
ack->robotid_ = des->robotid_;
ack->startuserid_ = des->startuserid_;
ack->users_ = des->users_;
ack->gatewayip_ = des->gatewayip_;
ack->gatewayport_ = des->gatewayport_;
ack->ret_ = 0;
S_INT_32 item = FindLstItemByName( des->robotname_);
if ( -1 != item)
{
char text[256];
sprintf(text, "%u", socket);
lstclients_.SetItem(item, 0, LVIF_TEXT, text, 0, 0, 0, 0);
sprintf(text, "%s", des->robotname_.c_str());
lstclients_.SetItem(item, 1, LVIF_TEXT, text, 0, 0, 0, 0);
sockaddr_in sa;
int salen;
salen = sizeof(sa);
if( getpeername( socket, (sockaddr*)&sa, &salen ) == 0 )
{
sprintf( text, "%s", inet_ntoa( sa.sin_addr));
lstclients_.SetItem(item, 2, LVIF_TEXT, text, 0, 0, 0, 0);
sprintf( text, "%d", ntohs( sa.sin_port));
lstclients_.SetItem(item, 3, LVIF_TEXT, text, 0, 0, 0, 0);
}
else
{
sprintf( text, "peer ip error");
lstclients_.SetItem(item, 2, LVIF_TEXT, text, 0, 0, 0, 0);
sprintf( text, "%d", ntohs( sa.sin_port));
lstclients_.SetItem(item, 3, LVIF_TEXT, text, 0, 0, 0, 0);
}
CTime tm = CTime::GetCurrentTime();
sprintf(text, "%.2d:%.2d:%.2d", tm.GetHour(), tm.GetMinute(), tm.GetSecond());
lstclients_.SetItem(item, 4, LVIF_TEXT, text, 0, 0, 0, 0);
sprintf(text, "%u", des->startuserid_);
lstclients_.SetItem(item, 5, LVIF_TEXT, text, 0, 0, 0, 0);
sprintf(text, "%u", des->users_);
lstclients_.SetItem(item, 6, LVIF_TEXT, text, 0, 0, 0, 0);
sprintf(text, "%u", 0);
lstclients_.SetItem(item, 7, LVIF_TEXT, text, 0, 0, 0, 0);
lstclients_.SetItemData( item, socket);
lstclients_.SetItem( item, 0, LVIF_IMAGE, "", ICON_CONNECTED, 0, 0, 0);
}
}
}
}
else
ack->ret_ = -1;
listener_.send_protocol(socket, ack);
}
break;
default:
break;
}
}
示例4: CheckConditionSpecificDate
BOOL TMonsterAIRuleInfo::CheckConditionSpecificDate()
{
CTime tCurrentTime = CTime::GetTickCount();
CTimeSpan tValidRange(0, 0, 0, this->m_iWaitTime+this->m_iContinuanceTime);
int iYear = tCurrentTime.GetYear();
int iMonth = tCurrentTime.GetMonth();
int iDay = tCurrentTime.GetDay();
int iDayOfWeek = tCurrentTime.GetDayOfWeek();
int iHour = tCurrentTime.GetHour();
int iMinute = tCurrentTime.GetMinute();
if ( this->m_iMonth != -1 )
{
if ( this->m_iMonth != iMonth )
{
CTime tConditionTime(iYear, this->m_iMonth, 0, 0, 0, 0, -1) ;
if ( tCurrentTime < tConditionTime ||
tCurrentTime > tConditionTime+tValidRange )
{
return FALSE;
}
}
}
if ( this->m_iDay != -1 )
{
if ( this->m_iDay != iDay )
{
CTime tConditionTime(iYear, (this->m_iMonth == -1)?iMonth : this->m_iMonth , this->m_iDay, 0, 0, 0, -1);
if ( tCurrentTime < tConditionTime ||
tCurrentTime > tConditionTime+tValidRange )
{
return FALSE;
}
}
}
if ( this->m_iWeekDay != -1 )
{
if ( this->m_iWeekDay != iDayOfWeek )
{
return FALSE;
}
}
if ( this->m_iHour != -1 )
{
if ( this->m_iHour != iHour )
{
CTime tConditionTime(iYear, (this->m_iMonth == -1)?iMonth : this->m_iMonth,
(this->m_iDay == -1)?iDay : this->m_iDay, this->m_iHour, 0, 0, -1) ;
if ( tCurrentTime < tConditionTime ||
tCurrentTime > tConditionTime+tValidRange )
{
return FALSE;
}
}
}
if ( this->m_iMinute != -1 )
{
if ( this->m_iMinute != iMinute )
{
CTime tConditionTime(iYear, (this->m_iMonth == -1)?iMonth : this->m_iMonth,
(this->m_iDay == -1)?iDay : this->m_iDay,
(this->m_iHour == -1)?iHour : this->m_iHour,
this->m_iMinute, 0, -1) ;
if ( tCurrentTime < tConditionTime ||
tCurrentTime > tConditionTime+tValidRange )
{
return FALSE;
}
}
}
return TRUE;
}
示例5: RecvNpcInfo
void CAISocket::RecvNpcInfo(char* pBuf)
{
int index = 0;
BYTE Mode; // 01(INFO_MODIFY) : NPC 정보 변경
// 02(INFO_DELETE) : NPC 정보 삭제
short nid; // NPC index
short sid; // NPC index
short sPid; // NPC Picture Number
short sSize = 100; // NPC Size
int iWeapon_1; // 오른손 무기
int iWeapon_2; // 왼손 무기
BYTE bZone; // Current zone number
char szName[MAX_NPC_SIZE+1]; // NPC Name
BYTE byGroup; // 소속 집단
BYTE byLevel; // level
float fPosX; // X Position
float fPosZ; // Z Position
float fPosY; // Y Position
BYTE byDirection; // 방향
BYTE tState; // NPC 상태
// 00 : NPC Dead
// 01 : NPC Live
BYTE tNpcKind; // 00 : Monster
// 01 : NPC
int iSellingGroup;
int nMaxHP; // 최대 HP
int nHP; // 현재 HP
BYTE byGateOpen;
short sHitRate; // 공격 성공률
BYTE byObjectType; // 보통 : 0, 특수 : 1
Mode = GetByte(pBuf, index);
nid = GetShort(pBuf, index);
sid = GetShort(pBuf, index);
sPid = GetShort(pBuf, index);
sSize = GetShort(pBuf, index);
iWeapon_1 = GetDWORD(pBuf, index);
iWeapon_2 = GetDWORD(pBuf, index);
bZone = GetByte(pBuf, index);
int nLength = GetVarString(szName, pBuf, sizeof(BYTE), index);
if(nLength < 0 || nLength > MAX_NPC_SIZE) return; // 잘못된 monster 아이디
byGroup = GetByte(pBuf, index);
byLevel = GetByte(pBuf, index);
fPosX = Getfloat(pBuf, index);
fPosZ = Getfloat(pBuf, index);
fPosY = Getfloat(pBuf, index);
byDirection = GetByte(pBuf, index);
tState = GetByte(pBuf, index);
tNpcKind = GetByte(pBuf, index);
iSellingGroup = GetDWORD(pBuf, index);
nMaxHP = GetDWORD(pBuf, index);
nHP = GetDWORD(pBuf, index);
byGateOpen = GetByte(pBuf, index);
sHitRate = GetShort(pBuf, index);
byObjectType = GetByte(pBuf, index);
CNpc* pNpc = NULL;
pNpc = m_pMain->m_arNpcArray.GetData(nid);
if(!pNpc) return;
pNpc->m_NpcState = NPC_DEAD;
if( pNpc->m_NpcState == NPC_LIVE ) { // 살아 있는데 또 정보를 받는 경우
char strLog[256];
CTime t = CTime::GetCurrentTime();
sprintf_s(strLog, sizeof(strLog), "## time(%d:%d-%d) npc regen check(%d) : nid=%d, name=%s, x=%d, z=%d, rx=%d, rz=%d ## \r\n", t.GetHour(), t.GetMinute(), t.GetSecond(), pNpc->m_NpcState, nid, szName, (int)pNpc->m_fCurX, (int)pNpc->m_fCurZ, pNpc->m_sRegion_X, pNpc->m_sRegion_Z);
EnterCriticalSection( &g_LogFile_critical );
m_pMain->m_RegionLogFile.Write( strLog, strlen(strLog) );
LeaveCriticalSection( &g_LogFile_critical );
TRACE(strLog);
// to-do: replace with m_pMain->WriteRegionLog(...);
}
pNpc->m_NpcState = NPC_LIVE;
pNpc->m_sNid = nid;
pNpc->m_sSid = sid;
pNpc->m_sPid = sPid;
pNpc->m_sSize = sSize;
pNpc->m_iWeapon_1 = iWeapon_1;
pNpc->m_iWeapon_2 = iWeapon_2;
strcpy(pNpc->m_strName, szName);
pNpc->m_byGroup = byGroup;
pNpc->m_byLevel = byLevel;
pNpc->m_bCurZone = bZone;
pNpc->m_pMap = m_pMain->GetZoneByID(bZone);
pNpc->m_fCurX = fPosX;
pNpc->m_fCurZ = fPosZ;
pNpc->m_fCurY = fPosY;
pNpc->m_byDirection = byDirection;
pNpc->m_NpcState = tState;
pNpc->m_tNpcType = tNpcKind;
pNpc->m_iSellingGroup = iSellingGroup;
pNpc->m_iMaxHP = nMaxHP;
pNpc->m_iHP = nHP;
pNpc->m_byGateOpen = byGateOpen;
pNpc->m_sHitRate = sHitRate;
pNpc->m_byObjectType = byObjectType;
//.........这里部分代码省略.........
示例6: RecvUserInfo
void CGameSocket::RecvUserInfo(char* pBuf)
{
// TRACE("RecvUserInfo()\n");
int index = 0;
short uid=-1, sHp, sMp, sLength = 0;
BYTE bNation, bLevel, bZone, bAuthority=1;
short sDamage, sAC;
float fHitAgi, fAvoidAgi;
char strName[MAX_ID_SIZE+1];
short sItemAC, sAmountLeft, sAmountRight;
BYTE bTypeLeft, bTypeRight;
uid = GetShort( pBuf, index );
sLength = GetShort( pBuf, index );
if( sLength > MAX_ID_SIZE || sLength <= 0 ) {
char countstr[256];
CTime cur = CTime::GetCurrentTime();
sprintf_s( countstr, "RecvUserInfo() Fail : %02d/%02d %02d:%02d - uid=%d, name=%s\r\n", cur.GetMonth(), cur.GetDay(), cur.GetHour(), cur.GetMinute(), uid, strName);
LogFileWrite( countstr );
TRACE("### RecvUserInfo() Fail ---> uid = %d, name=%s ### \n", uid, strName);
return;
}
GetString(strName, pBuf, sLength, index);
bZone = GetByte( pBuf, index );
bNation = GetByte( pBuf, index );
bLevel = GetByte( pBuf, index );
sHp = GetShort( pBuf, index );
sMp = GetShort( pBuf, index );
sDamage = GetShort( pBuf, index );
sAC = GetShort( pBuf, index );
fHitAgi = Getfloat( pBuf, index );
fAvoidAgi = Getfloat( pBuf, index );
//
sItemAC = GetShort(pBuf, index);
bTypeLeft = GetByte(pBuf, index);
bTypeRight = GetByte(pBuf, index);
sAmountLeft = GetShort(pBuf, index);
sAmountRight = GetShort(pBuf, index);
bAuthority = GetByte(pBuf, index);
//
//CUser* pUser = m_pMain->GetActiveUserPtr(uid);
//if( pUser == NULL ) return;
CUser* pUser = new CUser;
pUser->Initialize();
pUser->m_iUserId = uid;
strcpy(pUser->m_strUserID, strName);
pUser->m_curZone = bZone;
pUser->m_pMap = m_pMain->GetZoneByID(bZone);
pUser->m_bNation = bNation;
pUser->m_bLevel = bLevel;
pUser->m_sHP = sHp;
pUser->m_sMP = sMp;
//pUser->m_sSP = sSp;
pUser->m_sHitDamage = sDamage;
pUser->m_fHitrate = fHitAgi;
pUser->m_fAvoidrate = fAvoidAgi;
pUser->m_sAC = sAC;
pUser->m_bLive = USER_LIVE;
//
pUser->m_sItemAC = sItemAC;
pUser->m_bMagicTypeLeftHand = bTypeLeft;
pUser->m_bMagicTypeRightHand = bTypeRight;
pUser->m_sMagicAmountLeftHand = sAmountLeft;
pUser->m_sMagicAmountRightHand = sAmountRight;
pUser->m_byIsOP = bAuthority;
//
TRACE("**** RecvUserInfo()---> uid = %d, name=%s, leng=%d ******\n", uid, strName, sLength);
if(uid >= USER_BAND && uid < MAX_USER) {
m_pMain->m_pUser[uid] = pUser;
}
_USERLOG* pUserLog = NULL;
pUserLog = new _USERLOG;
pUserLog->t = CTime::GetCurrentTime();
pUserLog->byFlag = USER_LOGIN;
pUserLog->byLevel = pUser->m_bLevel;
strcpy( pUserLog->strUserID, pUser->m_strUserID );
pUser->m_UserLogList.push_back( pUserLog );
}
示例7: Convert
//*========================================================================================
//*函数: bool CSmartJZSRCTable::Convert(TSSmartDoc *pDoc, unsigned char *ucRawData)
//*功能: 转换结构
//*参数: 略
//*返回: 是否成功
//*说明: 虚基类程序
//*========================================================================================
bool CSmartJZSRCTable::Convert(int nAuthNo, TSSmartDoc *pDoc, unsigned char *ucRawData, char *pszAdjustCode)
{
CString strValue = "" ;
CString strText = "";
CString strData = "";
char szDateTime[7];
CString strDealCode = "20";
//收费机 0232 上机上网机
if( !strcmp(pDoc->m_szMacCode, "0226") ||
!strcmp(pDoc->m_szMacCode, "0232") )
{
strDealCode = "91";
}
//增值机
else if( !strcmp(pDoc->m_szMacCode, "0201") )
{
strDealCode = "90";
}
CTime t = CTime::GetCurrentTime();
strText.Format("%04d-%02d-%02d %02d:%02d:%02d ",
t.GetYear(), t.GetMonth(), t.GetDay(),
t.GetHour(), t.GetMinute(), t.GetSecond());
sprintf(szDateTime, "%04d%02d", t.GetYear(), t.GetMonth());
m_strTableName.Format("Smart_JZSource%04d%02d", t.GetYear(), t.GetMonth());
strValue.Format("注册号:%.2X%.2X%.2X%.2X ",ucRawData[0],ucRawData[1],ucRawData[2],ucRawData[3]); strText += strValue ;
GetValue(strValue, m_SRC.sMachineID);
strValue.Format("%s", m_SRC.sMachineID); strData+= strValue;
strValue.Format("扎帐流水:%d ", ucRawData[6]*256+ucRawData[7]); strText += strValue ;
GetValue(strValue, m_SRC.nSettleInvoice);
strValue.Format("%d", m_SRC.nSettleInvoice); strData+= strValue;
if( !IsValidDateTime(&ucRawData[8]) )
{
char szDateTime[24];
GetCurDateTime(szDateTime);
strValue = szDateTime; strText += strValue ;
GetValue(strValue, m_SRC.sSettleTime);
}
else
{
strValue.Format("扎帐时间:%04d-%02d-%02d %02d:%02d:%02d ",ucRawData[8]+2000,ucRawData[9],ucRawData[10],ucRawData[11],ucRawData[12],ucRawData[13]); strText += strValue ;
GetValue(strValue, m_SRC.sSettleTime);
}
strValue.Format("%s", m_SRC.sSettleTime); strData+= strValue;
strValue.Format("起始流水号:%d ",ucRawData[14]*256+ucRawData[15]); strText += strValue ;
GetValue(strValue, m_SRC.nBeginInvoice);
strValue.Format("%d", m_SRC.nBeginInvoice); strData+= strValue;
strValue.Format("结束流水号:%d ",ucRawData[16]*256+ucRawData[17]); strText += strValue ;
GetValue(strValue, m_SRC.nEndInvoice);
strValue.Format("%d", m_SRC.nEndInvoice); strData+= strValue;
strValue.Format("正常消费总笔数:%d ",ucRawData[18]*256+ucRawData[19]); strText += strValue ;
GetValue(strValue, m_SRC.nDealCount);
strValue.Format("%d", m_SRC.nDealCount); strData+= strValue;
strValue.Format("正常消费总金额:%d ",ucRawData[20]+ucRawData[21]*256+ucRawData[22]*65536); strText += strValue ;
GetValue(strValue, m_SRC.nDealAmount);
strValue.Format("%d", m_SRC.nDealAmount); strData+= strValue;
strValue.Format("冲正消费总笔数:%d ",ucRawData[23]*256+ucRawData[24]); strText += strValue ;
GetValue(strValue, m_SRC.nCancelCount);
strValue.Format("%d", m_SRC.nCancelCount); strData+= strValue;
strValue.Format("冲正消费总金额:%d ",ucRawData[25]+ucRawData[26]*256+ucRawData[27]*65536); strText += strValue ;
GetValue(strValue, m_SRC.nCancelAmount);
strValue.Format("%d", m_SRC.nCancelAmount); strData+= strValue;
strValue.Format("异常消费总笔数%d\n",ucRawData[28]*256+ucRawData[29]); strText += strValue ;
GetValue(strValue, m_SRC.nExcepCount);
strValue.Format("%d", m_SRC.nExcepCount); strData+= strValue;
strValue.Format("异常消费总金额%d\n",ucRawData[30]+ucRawData[31]*256+ucRawData[32]*65536); strText += strValue ;
GetValue(strValue, m_SRC.nExcepACount);
strValue.Format("%d", m_SRC.nExcepACount); strData+= strValue;
strValue.Format("其他交易总笔数:%d ",ucRawData[33]*256+ucRawData[34]); strText += strValue ;
GetValue(strValue, m_SRC.nOtherCount);
strValue.Format("%d", m_SRC.nOtherCount); strData+= strValue;
strValue.Format("扎帐标记:%.2X ",ucRawData[35]); strText += strValue ;
GetValue(strValue, m_SRC.nOuterkeeper);
strValue.Format("%d", m_SRC.nOuterkeeper); strData+= strValue;
//.........这里部分代码省略.........
示例8: CalcExpiration
//MORPH - Changed by SiRoB, SLS keep only for rar files, reduce saved source and life time
//CString CSourceSaver::CalcExpiration(int Days)
CString CSourceSaver::CalcExpiration(int Minutes)
{
CTime expiration = CTime::GetCurrentTime();
//MORPH - Changed by SiRoB, SLS keep only for rare files, reduce Saved Source and life time
//CTimeSpan timediff(Days, 0, 0, 0);
CTimeSpan timediff(Minutes/1440, (Minutes/60) % 24, Minutes % 60, 0);
expiration += timediff;
CString strExpiration;
//MORPH - Changed by SiRoB, SLS keep only for rare files, reduce Saved Source and life time
//strExpiration.Format("%02i%02i%02i", (expiration.GetYear() % 100), expiration.GetMonth(), expiration.GetDay());
strExpiration.Format(_T("%02i%02i%02i%02i%02i"), (expiration.GetYear() % 100), expiration.GetMonth(), expiration.GetDay(), expiration.GetHour(),expiration.GetMinute());
return strExpiration;
}
示例9: AppendMessage
void CMessageDlg::AppendMessage(const TextMessage& msg, BOOL bStore/* = TRUE*/)
{
//append to message list
if(bStore)
m_messages.push_back(msg);
//insert enter
m_richHistory.SetSel(0,0);
m_richHistory.ReplaceSel(_T("\r\n"));
//insert msg
m_richHistory.SetSel(0,0);
m_richHistory.ReplaceSel( msg.szMessage );
CHARFORMAT cf;
cf.cbSize = sizeof (CHARFORMAT);
cf.dwMask = CFM_COLOR | CFM_UNDERLINE | CFM_BOLD;
cf.dwEffects = (unsigned long)~(CFE_AUTOCOLOR | CFE_UNDERLINE | CFE_BOLD);
cf.crTextColor = RGB(0, 0, 0);
m_richHistory.SetSel(0, long(_tcslen(msg.szMessage)));
m_richHistory.SetSelectionCharFormat(cf);
//insert enter
m_richHistory.SetSel(0,0);
m_richHistory.ReplaceSel(_T("\r\n"));
CTime tm = CTime::GetCurrentTime();
CString szTime;
szTime.Format(_T("%.2d:%.2d"), tm.GetHour(), tm.GetMinute());
CString name;
if(msg.nFromUserID == m_myself.nUserID)
name.Format(_T("%s:"), GetDisplayName(m_myself));
else
{
name.Format(_T("%s:"), GetDisplayName(m_user));
}
if(m_bShowTimeStamp)
name = szTime + _T(" ") + name;
//insert name
m_richHistory.SetSel(0,0);
m_richHistory.ReplaceSel(name);
memset(&cf,0,sizeof (CHARFORMAT));
cf.cbSize = sizeof (CHARFORMAT);
cf.dwMask = CFM_COLOR | CFM_UNDERLINE | CFM_BOLD;
cf.dwEffects = CFE_UNDERLINE | CFE_BOLD;
if(msg.nFromUserID == m_myself.nUserID)
cf.crTextColor = RGB(0, 0, 255);
else
{
if(m_user.uUserType & USERTYPE_ADMIN)
cf.crTextColor = RGB(255, 117, 5);
else
cf.crTextColor = RGB(255, 0, 0);
}
m_richHistory.SetSel(0,name.GetLength());
m_richHistory.SetSelectionCharFormat(cf);
m_richHistory.HideSelection(TRUE, FALSE);
if(bStore)
WriteLogMsg(m_logFile, name + msg.szMessage + _T("\r\n"));
}
示例10: WriteSerialNumber
void CBatchSNDlg::WriteSerialNumber(unsigned long SN){
CStdioFile file;
CString filepath;
CString SerialDate;
CTime time = CTime::GetCurrentTime();
SerialDate.Format(_T("\n%d,%d-%d-%d %d:%d:%d"),SN,time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
filepath=g_strExePth+_T("Sensor Serial Record.txt");
if(!file.Open(filepath, CFile::shareDenyNone|CFile::modeReadWrite))
{
return ;
}
file.SeekToEnd();
file.WriteString(SerialDate.GetBuffer());
// file.Flush();
file.Close();
}
示例11: SomeThing
//处里THREAD的函式
void CKThread::SomeThing(void)
{
do
{
CTime time = CTime::GetCurrentTime();
int m_nYear = time.GetYear(); ///年
int m_nMonth = time.GetMonth(); ///月
int m_nDay = time.GetDay(); ///日
int m_nhour = time.GetHour();
int m_nmin = time.GetMinute();
int m_nsec = time.GetSecond();
if(m_vpArray.size() > 0 )
{
/*EnterCriticalSection(&m_guard);
for(UINT i = 0; i < m_vpArray.size();i++)
{
CString str1 = m_vpArray[0];
CString str = m_CKbirdge.SendMsg(str1);
if(!str.Compare("ok"))
{
m_vpArray.erase( m_vpArray.begin( ) );
}
Sleep(30);
}
LeaveCriticalSection(&m_guard);*/
if(sort == 3) {
string bb = "xxx";
}
int sendflag=0;
CString SendStr="";
int start1 = 25;
int start2 = 24;
if(m_vpArray.size() < start1) {
sendflag=m_vpArray.size()-1;
}
else
{
sendflag =start2;
}
bool rtn = false;
EnterCriticalSection(&m_guard);
try {
//m_OraDal.AddData(m_vpArray[0]);
//m_vpArray.erase( m_vpArray.begin( ));
for(UINT i = 0; i <= sendflag;i++)
{
SendStr += m_vpArray[i];
if(i< sendflag) SendStr += "$";
if(i == sendflag) {
SendStr = "Stock$"+SendStr ;
CString str = m_CKbirdge.SendMsg(SendStr);
if(!str.Compare("ok"))
{
for(UINT j = 0; j <= sendflag;j++) {
m_vpArray.erase( m_vpArray.begin( ) );
}
}
}
}
restartCount++;
}
catch(...) {
//Release();
//Init();
}
LeaveCriticalSection(&m_guard);
if(sendCount >=10) {
Sleep(100);
}
else {
Sleep(5);
}
if(sendCount > 100000) sendCount = 10;
if(restartCount>=500) {
m_CKbirdge.Release();
m_CKbirdge.Init();
restartCount=0;
}
}
else {
//restartCount++;
// if(restartCount>=60) {
// //m_CKbirdge.Release();
// //m_CKbirdge.Init();
// restartCount=0;
//}
//.........这里部分代码省略.........
示例12: Check
int CScheduler::Check(bool forcecheck){
if (!thePrefs.IsSchedulerEnabled()
|| theApp.scheduler->GetCount()==0
|| !theApp.emuledlg->IsRunning()) return -1;
Schedule_Struct* schedule;
struct tm tmTemp;
CTime tNow = CTime(safe_mktime(CTime::GetCurrentTime().GetLocalTm(&tmTemp)));
if (!forcecheck && tNow.GetMinute()==m_iLastCheckedMinute) return -1;
m_iLastCheckedMinute=tNow.GetMinute();
theApp.scheduler->RestoreOriginals();
for (uint8 si=0;si<theApp.scheduler->GetCount();si++) {
schedule=theApp.scheduler->GetSchedule(si);
if (schedule->actions[0]==0 || !schedule->enabled) continue;
// check day of week
if (schedule->day!=DAY_DAYLY) {
int dow=tNow.GetDayOfWeek();
switch (schedule->day) {
case DAY_MO : if (dow!=2) continue;
break;
case DAY_DI : if (dow!=3) continue;
break;
case DAY_MI : if (dow!=4) continue;
break;
case DAY_DO : if (dow!=5) continue;
break;
case DAY_FR : if (dow!=6) continue;
break;
case DAY_SA : if (dow!=7) continue;
break;
case DAY_SO : if (dow!=1) continue;
break;
case DAY_MO_FR : if (dow==7 || dow==1 ) continue;
break;
case DAY_MO_SA : if (dow==1) continue;
break;
case DAY_SA_SO : if (dow>=2 && dow<=6) continue;
}
}
//check time
UINT h1,h2,m1,m2;
CTime t1=CTime(schedule->time);
CTime t2=CTime(schedule->time2);
h1=t1.GetHour(); h2=t2.GetHour();
m1=t1.GetMinute(); m2=t2.GetMinute();
int it1,it2, itn;
it1=h1*60 + m1;
it2=h2*60 + m2;
itn=tNow.GetHour()*60 + tNow.GetMinute();
if (it1<=it2) { // normal timespan
if ( !(itn>=it1 && itn<it2) ) continue;
} else { // reversed timespan (23:30 to 5:10) now 10
if ( !(itn>=it1 || itn<it2)) continue;
}
// ok, lets do the actions of this schedule
ActivateSchedule(si,schedule->time2==0);
}
return -1;
}
示例13: OnTimer
void OnTimer( WORD wTimerID )
{
if( wTimerID == TIMER_ID_DEFAULT )
{
g_GameTimer.Compute();
#ifdef __EVE_NEWYEAR
static BOOL s_bCountdown = FALSE;
CTime tmCur = CTime::GetCurrentTime();
if( ::GetLanguage() == LANG_GER || ::GetLanguage() == LANG_FRE )
{
if( !s_bCountdown && tmCur > CTime( 2009, 12, 31, 22, 58, 59 ) && tmCur < CTime( 2009, 12, 31, 23, 0, 0 ) )
{
s_bCountdown = TRUE;
g_DPCacheSrvr.SendHdr( PACKETTYPE_NEWYEAR, DPID_ALLPLAYERS, DPID_ALLPLAYERS );
}
if( tmCur > CTime( 2009, 12, 31, 23, 0, 0 ) )
s_bCountdown = FALSE;
}
else
{
if( !s_bCountdown && tmCur > CTime( 2009, 12, 31, 23, 58, 59 ) && tmCur < CTime( 2010, 1, 1, 0, 0, 0 ) )
{
s_bCountdown = TRUE;
g_DPCacheSrvr.SendHdr( PACKETTYPE_NEWYEAR, DPID_ALLPLAYERS, DPID_ALLPLAYERS );
}
if( tmCur > CTime( 2010, 1, 1, 0, 0, 0 ) )
s_bCountdown = FALSE;
}
#endif // __EVE_NEWYEAR
return;
}
#if !defined(__INTERNALSERVER)
if( wTimerID == TIMER_ID_WANTED ) // 현상금 처리
{
g_dpCoreSrvr.SendCWWantedList(); // 현상금 리스트를 보낸다.
return;
}
#endif // __INTERNALSERVER
#ifdef __EVENT0913
if( wTimerID == TIMER_ID_EVENT0913 )
{
CTime tmCurr = CTime::GetCurrentTime();
BOOL bEventTime = ( tmCurr.GetHour() >= 17 && tmCurr.GetHour() < 18 ) || ( tmCurr.GetHour() >= 22 && tmCurr.GetHour() < 23 );
if( bEventTime && !s_bEvent0913 ) // 이벤트 시간 - 이벤트 설정되어 있지 않으면,
{
g_dpCoreSrvr.SendEvent0913( s_bEvent0913 = TRUE );
}
else if( !bEventTime && s_bEvent0913 ) // 이벤트 시간이 아닌데 이벤트 설정되어 있으면,
{
g_dpCoreSrvr.SendEvent0913( s_bEvent0913 = FALSE );
}
}
#endif // __EVENT0913
#ifdef __EVENT1206
if( wTimerID == TIMER_ID_EVENT1206 )
{
CTime tmCurr = CTime::GetCurrentTime();
BOOL bEventTime;
if( s_bTest )
{
bEventTime = ( tmCurr.GetHour() % 2 == 0 ); // even
}
else
{
bEventTime = ( tmCurr >= CTime( 2005, 12, 10, 19, 0, 0 ) && tmCurr < CTime( 2005, 12, 10, 22, 0, 0 ) )
|| ( tmCurr >= CTime( 2005, 12, 11, 19, 0, 0 ) && tmCurr < CTime( 2005, 12, 11, 22, 0, 0 ) );
}
if( bEventTime && !s_bEvent1206 ) // 이벤트 시간 - 이벤트 설정되어 있지 않으면,
{
g_dpCoreSrvr.SendEvent1206( s_bEvent1206 = TRUE );
}
else if( !bEventTime && s_bEvent1206 ) // 이벤트 시간이 아닌데 이벤트 설정되어 있으면,
{
g_dpCoreSrvr.SendEvent1206( s_bEvent1206 = FALSE );
}
}
#endif // __EVENT1206
if( wTimerID == TIMER_ID_EVENT )
{
BOOL f = FALSE;
CTime tmCurr = CTime::GetCurrentTime();
BOOL bXmas;
if( s_bTest )
{
bXmas = tmCurr < CTime( 2005, 12, 26, 10, 0, 0 );
}
else
{
bXmas = ( tmCurr >= CTime( 2005, 12, 23, 0, 0, 0 ) && tmCurr < CTime( 2005, 12, 27, 9, 0, 0 ) );
}
BOOL bNewYear;
if( s_bTest )
{
//.........这里部分代码省略.........
示例14: CheckAndTrigger
void Alarm::CheckAndTrigger()
{
if (ValidFieldFlags == 0)
return;
BOOL Triggered = TRUE;
CTime now = CTime::GetCurrentTime();
if ((ValidFieldFlags & VF_TIMEOFDAY) != 0)
{
if ((now.GetHour() != TimeOfDayHour) ||
(now.GetMinute() != TimeOfDayMinute))
{
Triggered = FALSE;
}
}
if ((ValidFieldFlags & VF_DAYOFWEEK) != 0)
{
if (now.GetDayOfWeek() != DayOfWeek)
Triggered = FALSE;
}
if ((ValidFieldFlags & VF_DAYOFMONTH) != 0)
{
if (now.GetDay() != DayOfMonth)
Triggered = FALSE;
}
if ((ValidFieldFlags & VF_MONTHOFYEAR) != 0)
{
if (now.GetMonth() != MonthOfYear)
Triggered = FALSE;
}
if (Triggered)
{
CTimeSpan timeSinceLastTrigger = now - TimeLastTriggered;
if ((ValidFieldFlags & VF_TIMEOFDAY) != 0)
{
if (timeSinceLastTrigger.GetTotalMinutes() < 2)
Triggered = FALSE;
}
else if (((ValidFieldFlags & VF_DAYOFWEEK) != 0) ||
((ValidFieldFlags & VF_DAYOFMONTH) != 0))
{
if (timeSinceLastTrigger.GetTotalHours() < 26)
Triggered = FALSE;
}
else
{
if (timeSinceLastTrigger.GetTotalHours() < (24*33))
Triggered = FALSE;
}
}
if (Triggered)
{
TimeLastTriggered = now;
TRACE1("TRIGGER: %s\n", TextMessage);
DAlarmNotify& dlg = *new DAlarmNotify;
dlg.TextMessage = TextMessage;
dlg.Create(IDD_ALARMNOTIFY);
dlg.ShowWindow(SW_SHOW);
sndPlaySound(((CAlarmsDlg*)theApp.m_pMainWnd)->alarmsSoundFile,SND_ASYNC);
}
}
示例15: ReConnectODBC
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());
}