本文整理汇总了C++中CDateTime::ToDateTimeString方法的典型用法代码示例。如果您正苦于以下问题:C++ CDateTime::ToDateTimeString方法的具体用法?C++ CDateTime::ToDateTimeString怎么用?C++ CDateTime::ToDateTimeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDateTime
的用法示例。
在下文中一共展示了CDateTime::ToDateTimeString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMessage_AddInRoomTime
int32_t CFromRoomAddEvent::OnMessage_AddInRoomTime(MessageHeadSS * pMsgHead, IMsgBody* pMsgBody, const uint16_t nOptionLen , const void *pOptionData)
{
if(pMsgHead == NULL || pMsgBody == NULL)
{
WRITE_ERROR_LOG("null pointer: roomserver add in roomtime!{pMsgHead=0x%08X, pMsgBody=0x%08X}\n",
pMsgHead, pMsgBody);
return E_NULLPOINTER;
}
int32_t ret = S_OK;
// int32_t threadindex = 需要获取线程ID
CAddAdmInRoomOnLineTimeNotice* pTmpBody = dynamic_cast<CAddAdmInRoomOnLineTimeNotice*>(pMsgBody);
if(pTmpBody == NULL)
{
WRITE_ERROR_LOG("get msg body failed!");
return E_NULLPOINTER;
}
RoleRank rolerank = pTmpBody->nRoleRank;
//时间类
CDateTime dt = CDateTime::CurrentDateTime();
char szDateTime[enmMaxTimeStringLength] = {0};
dt.ToDateTimeString(szDateTime);
//更新管理员在房间时长日表
ret = UpdateAdminInRoomOnlineTimeDay(*pTmpBody, rolerank);
if(0 > ret)
{
WRITE_ERROR_LOG( "update admin in room online time failed, operation time: %s, roleid=%d, roomid=%d, addtime=%d, msgid=0x%08X\n",
szDateTime,
pTmpBody->nRoleID,
pTmpBody->nRoomID,
pTmpBody->nAddTime,
pMsgHead->nMessageID);
return ret;
}
// WRITE_DEBUG_LOG( "update admin in room online time success! operation time: %s, roleid=%d, roomid=%d, addtime=%d, msgid=0x%08X\n",
// szDateTime,
// pTmpBody->nRoleID,
// pTmpBody->nRoomID,
// pTmpBody->nAddTime,
// pMsgHead->nMessageID);
//更新管理员在房间时长总表(更新两张表, 一张跟房间号相关, 一张无关)
ret = UpdateAdminInRoomOnlineTimeTotal(pTmpBody->nRoleID, pTmpBody->nRoomID, pTmpBody->nAddTime, rolerank);
if(0 > ret)
{
WRITE_ERROR_LOG( "add admin inroom online total time failed! errorcode=0x%08X\n", ret);
return ret;
}
//WRITE_DEBUG_LOG( "add admin inroom online total time success!\n");
return S_OK;
}
示例2: InsertPlayerIntoRoomBlackList
FRAME_DBPROXY_NAMESPACE_BEGIN
int32_t CFromRoomAddEvent:: OnMessage_AddBlacklist(MessageHeadSS * pMsgHead, IMsgBody* pMsgBody, const uint16_t nOptionLen, const void *pOptionData )
{
if(pMsgHead == NULL || pMsgBody == NULL)
{
WRITE_ERROR_LOG("null pointer: roomserver add black list!{pMsgHead=0x%08X, pMsgBody=0x%08X}\n",
pMsgHead, pMsgBody);
return E_NULLPOINTER;
}
int32_t ret = S_OK;
// int32_t threadindex = 需要获取线程ID
CAddPlayerToBlackReq* pTmpBody = dynamic_cast<CAddPlayerToBlackReq*>(pMsgBody);
if(pTmpBody == NULL)
{
WRITE_ERROR_LOG("get msg body failed!");
return E_NULLPOINTER;
}
CAddPlayerToBlackResp set_rolerank;
MessageHeadSS resphead;
ObtainRespHead(pMsgHead, resphead,MSGID_DBRS_ADD_BLACK_RESP);
set_rolerank.nResult = S_OK;
g_Frame.PostMessage(&resphead, &set_rolerank, nOptionLen, (const char*)pOptionData);
DumpMessage("", &resphead, &set_rolerank, nOptionLen, (const char*)pOptionData);
//时间类
CDateTime dt = CDateTime::CurrentDateTime();
char szDateTime[enmMaxTimeStringLength] = {0};
dt.ToDateTimeString(szDateTime);
ret = InsertPlayerIntoRoomBlackList(pTmpBody->nRoleID, pTmpBody->nRoomID, szDateTime, pMsgHead->nRoleID);
if(0 > ret)
{
WRITE_ERROR_LOG("Error: process roomserver add black list request failed! errorcode=0x%08X\n",
ret);
return ret;
}
WRITE_DEBUG_LOG( "process roomserver add black success! \n");
return S_OK;
}