本文整理汇总了C++中CTime::GetGmtTm方法的典型用法代码示例。如果您正苦于以下问题:C++ CTime::GetGmtTm方法的具体用法?C++ CTime::GetGmtTm怎么用?C++ CTime::GetGmtTm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTime
的用法示例。
在下文中一共展示了CTime::GetGmtTm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendContent
void CWebSocket::SendContent(LPCSTR szStdResponse, const void *pContent, DWORD dwContentSize)
{
EMULE_TRY
char szBuf[2*1024], acGMT[EP_MAX_HTTPGMTSTR];
CTime timeCurrent = CTime::GetCurrentTime();
struct tm stTm = {0};
acGMT[0] = '\0';
if (timeCurrent.GetGmtTm(&stTm) != NULL)
Gmt2HttpStr(acGMT, &stTm);
int iLen = wsprintfA( szBuf,
"HTTP/1.1 200 OK\r\n"
"Date: %s\r\n" // HTTP/1.x response header "Date:"
"Server: " WS_SERVER_TOKEN "\r\n" // HTTP/1.x response header "Server:"
"%s"
"Content-Length: %u\r\n"
"Connection: close\r\n\r\n",
acGMT,
szStdResponse,
dwContentSize );
SendData(szBuf, iLen);
SendData(pContent, dwContentSize);
EMULE_CATCH2
}
示例2: DumpDevice
void CDevicesDlg::DumpDevice(int nCur)
{
DeviceInfo& info = m_Devs[nCur];
m_editSN.GetWindowText(info.SN, RC_MAX_SN_LEN);
m_editName.GetWindowText(info.Name, RC_MAX_NAME_LEN);
m_editDesc.GetWindowText(info.Desc, RC_MAX_DESC_LEN);
if (info.Index == -1)
info.CreateTime = time(NULL);
if (m_chkValid.GetCheck()) {
CTime valid;
m_dtValid.GetTime(valid);
struct tm t;
info.ValidTime = mktime(valid.GetGmtTm(&t));
}
else {
info.ValidTime = 0;
}
m_listDevs.SetItemText(nCur, 0, info.Name);
m_listDevs.SetItemText(nCur, 1, info.SN);
m_listDevs.SetItemText(nCur, 2, info.Desc);
}
示例3: SendReply
void CWebSocket::SendReply(int iHTTPRespCode)
{
char acBuf[256], acGMT[EP_MAX_HTTPGMTSTR];
const char *pcHTTPStatus;
CTime timeCurrent = CTime::GetCurrentTime();
struct tm stTm = {0};
acGMT[0] = '\0';
if (timeCurrent.GetGmtTm(&stTm) != NULL)
Gmt2HttpStr(acGMT, &stTm);
// Convert HTTP status code into a HTTP status message
// If an unknown status code is sent send "500 Internal Server Error"
switch (iHTTPRespCode)
{
case 304:
pcHTTPStatus = "304 Not Modified";
break;
case 404:
pcHTTPStatus = "404 Not Found";
break;
default:
pcHTTPStatus = "500 Internal Server Error";
break;
}
int iLen = wsprintfA( acBuf,
"HTTP/1.1 %s\r\n"
"Date: %s\r\n" // HTTP/1.x response header "Date:"
"Server: " WS_SERVER_TOKEN "\r\n" // HTTP/1.x response header "Server:"
"Connection: close\r\n\r\n",
pcHTTPStatus,
acGMT );
ASSERT(iLen < ARRSIZE(acBuf));
SendData(acBuf, iLen);
}