本文整理汇总了C++中DateTime::GetDay方法的典型用法代码示例。如果您正苦于以下问题:C++ DateTime::GetDay方法的具体用法?C++ DateTime::GetDay怎么用?C++ DateTime::GetDay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime
的用法示例。
在下文中一共展示了DateTime::GetDay方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formatDate
String Utils::formatDate(DateTime dateTime){
int day= dateTime.GetDay();;
int month= dateTime.GetMonth();
int year= dateTime.GetYear();
String date = L"";
if(day<10) date.Append('0');
date.Append(day);
date.Append('/');
if(month<10) date.Append('0');
date.Append(month);
date.Append('/');
date.Append(year);
return date;
}
示例2: Startup
bool LoginServer::Startup()
{
GetInfoFromIni();
DateTime time;
CreateDirectory("Logs",NULL);
m_fpLoginServer = fopen("./Logs/LoginServer.log", "a");
if (m_fpLoginServer == nullptr)
{
printf("ERROR: Unable to open log file.\n");
return false;
}
m_fpUser = fopen(string_format("./Logs/Login_%d_%d_%d.log",time.GetDay(),time.GetMonth(),time.GetYear()).c_str(), "a");
if (m_fpUser == nullptr)
{
printf("ERROR: Unable to open user log file.\n");
return false;
}
if (!m_DBProcess.Connect(m_ODBCName, m_ODBCLogin, m_ODBCPwd))
{
printf("ERROR: Unable to connect to the database using the details configured.\n");
return false;
}
printf("Connected to database server.\n");
if (!m_DBProcess.LoadVersionList())
{
printf("ERROR: Unable to load the version list.\n");
return false;
}
printf("Latest version in database: %d\n", GetVersion());
InitPacketHandlers();
if (!m_socketMgr.Listen(m_LoginServerPort, MAX_USER))
{
printf("ERROR: Failed to listen on server port.\n");
return false;
}
m_socketMgr.RunServer();
g_timerThreads.push_back(new Thread(Timer_UpdateUserCount));
return true;
}
示例3: getTimeAndDate
void TizenSystem::getTimeAndDate(TimeDate &td) const {
DateTime currentTime;
if (E_SUCCESS == SystemTime::GetCurrentTime(WALL_TIME, currentTime)) {
td.tm_sec = currentTime.GetSecond();
td.tm_min = currentTime.GetMinute();
td.tm_hour = currentTime.GetHour();
td.tm_mday = currentTime.GetDay();
td.tm_mon = currentTime.GetMonth();
td.tm_year = currentTime.GetYear();
Calendar *calendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
calendar->SetTime(currentTime);
td.tm_wday = calendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1;
delete calendar;
}
}
示例4: Startup
bool CServerDlg::Startup()
{
g_timerThreads.push_back(new Thread(Timer_CheckAliveTest));
m_sMapEventNpc = 0;
m_bFirstServerFlag = false;
// Server Start
DateTime time;
printf("Server started on %04d-%02d-%02d at %02d:%02d\n\n", time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute());
//----------------------------------------------------------------------
// DB part initialize
//----------------------------------------------------------------------
GetServerInfoIni();
if (!m_GameDB.Connect(m_strGameDSN, m_strGameUID, m_strGamePWD, false))
{
OdbcError *pError = m_GameDB.GetError();
printf("ERROR: Could not connect to the database server, received error:\n%s\n",
pError->ErrorMessage.c_str());
delete pError;
return false;
}
//----------------------------------------------------------------------
// Communication Part Initialize ...
//----------------------------------------------------------------------
if (!m_socketMgr.Listen(AI_SERVER_PORT, MAX_SOCKET))
return false;
//----------------------------------------------------------------------
// Load tables
//----------------------------------------------------------------------
if (!GetMagicTableData()
|| !GetMagicType1Data()
|| !GetMagicType2Data()
|| !GetMagicType4Data()
|| !GetNpcItemTable()
|| !GetMakeItemGroupTable()
|| !GetMakeWeaponItemTableData()
|| !GetMakeDefensiveItemTableData()
|| !GetMakeGradeItemTableData()
|| !GetMakeLareItemTableData()
|| !GetServerResourceTable()
|| !GetNpcTableData(false)
|| !GetNpcTableData(true)
// Load maps
|| !MapFileLoad()
// Spawn NPC threads
|| !CreateNpcThread())
return false;
//----------------------------------------------------------------------
// Start NPC THREAD
//----------------------------------------------------------------------
ResumeAI();
return true;
}
示例5: unknown
void
UtilitiesTester::TestReceivedHeaderParse_()
{
String sHeader = "from host.edu (host.edu [1.2.3.4]) by mail.host.edu (8.8.5) id 004A21; Tue, Mar 18 1997 14:36:17 -0800 (PST)";
String sRecipient = Utilities::GetRecipientFromReceivedHeader(sHeader);
if (sRecipient != _T(""))
throw;
String hostName = Utilities::GetHostNameFromReceivedHeader(sHeader);
if (hostName != _T("host.edu"))
throw;
sHeader = "from host.edu (host.edu [1.2.3.4]) by mailhost.host.edu (8.8.5/8.7.2) with ESMTP id LAA20869 for <[email protected]>; Tue, 18 Mar 1997 14:39:24 -0800 (PST)";
sRecipient = Utilities::GetRecipientFromReceivedHeader(sHeader);
if (sRecipient != _T("[email protected]"))
throw;
hostName = Utilities::GetHostNameFromReceivedHeader(sHeader);
if (hostName != _T("host.edu"))
throw;
sHeader = "Received: from unknown (HELO mail-***.icp-***-irony4.*****.***.au) ([123.123.123.123])\r\n "
"(envelope-sender <[email protected]>)\r\n"
"by mail.*****.***.au (qmail-ldap-1.03) with SMTP\r\n"
"for <[email protected]>; 20 Oct 2006 04:42:47 -0000\r\n";
sRecipient = Utilities::GetRecipientFromReceivedHeader(sHeader);
if (sRecipient != _T("[email protected]"))
throw;
hostName = Utilities::GetHostNameFromReceivedHeader(sHeader);
if (hostName != _T("unknown"))
throw;
sHeader = "Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) "
"by j218.ryd.student.liu.se (Postfix) with ESMTP id D84F433035 "
"for <[email protected]>; Thu, 14 Mar 2002 21:39:17 +0100 (CET) ";
sRecipient = Utilities::GetRecipientFromReceivedHeader(sHeader);
if (sRecipient != _T("[email protected]"))
throw;
hostName = Utilities::GetHostNameFromReceivedHeader(sHeader);
if (hostName != _T("mail.lysator.liu.se"))
throw;
sHeader = "Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) "
"by j218.ryd.student.liu.se (Postfix) with ESMTP id D84F433035 "
"for <[email protected]>; Thu, 14 Mar 2002 21:39:17 +0100 (CET) ";
DateTime dtTime = Utilities::GetDateTimeFromReceivedHeader(sHeader);
if (dtTime.GetYear() != 2002 ||
dtTime.GetMonth() != 3 ||
dtTime.GetDay() != 14 ||
dtTime.GetHour() != 20 ||
dtTime.GetMinute() != 39 ||
dtTime.GetSecond() != 17)
throw;
hostName = Utilities::GetHostNameFromReceivedHeader(sHeader);
if (hostName != _T("mail.lysator.liu.se"))
throw;
// Test IP Address parsing
sHeader = "Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) "
"by j218.ryd.student.liu.se (Postfix) with ESMTP id D84F433035 "
"for <[email protected]>; Thu, 14 Mar 2002 21:39:17 +0100 (CET) ";
String sIPAddress = Utilities::GetIPAddressFromReceivedHeader(sHeader).ToString();
if (sIPAddress != _T("130.236.254.3"))
throw;
hostName = Utilities::GetHostNameFromReceivedHeader(sHeader);
if (hostName != _T("mail.lysator.liu.se"))
throw;
sHeader = "from host.edu (host.edu [1.2.3.4]) by mail.host.edu (8.8.5) id 004A21; Tue, Mar 18 1997 14:36:17 -0800 (PST)";
sIPAddress = Utilities::GetIPAddressFromReceivedHeader(sHeader).ToString();
if (sIPAddress != _T("1.2.3.4"))
throw;
hostName = Utilities::GetHostNameFromReceivedHeader(sHeader);
if (hostName != _T("host.edu"))
throw;
sHeader = "Received: from unknown (HELO mail-***.icp-***-irony4.*****.***.au) ([123.123.123.125])\r\n "
"(envelope-sender <[email protected]>)\r\n"
"by mail.*****.***.au (qmail-ldap-1.03) with SMTP\r\n"
"for <[email protected]>; 20 Oct 2006 04:42:47 -0000\r\n";
sIPAddress = Utilities::GetIPAddressFromReceivedHeader(sHeader).ToString();
if (sIPAddress != _T("123.123.123.125"))
throw;
hostName = Utilities::GetHostNameFromReceivedHeader(sHeader);
if (hostName != _T("unknown"))
throw;
sHeader = "Received: from outbound1.den.paypal.com ([216.113.188.96])\r\n"
" by mail.hmailserver.com\r\n"
" ; Sun, 13 Dec 2009 09:22:54 +0100\r\n";
//.........这里部分代码省略.........
示例6: TimerTick
void CameraDelayedLooper::TimerTick(int nID)
{
if (nID == CAMERA_ID)
{
DateTime pcTime = DateTime::Now();
BitmapImage* pcBitmapImage;
BitmapImage* pcSaveImage;
os::String cScreenShotPath;
os::Desktop m_Screen;
pcSaveImage = new os::BitmapImage( Bitmap::SHARE_FRAMEBUFFER | Bitmap::ACCEPT_VIEWS );
pcSaveImage->SetColorSpace( CS_RGBA32 );
pcSaveImage->ResizeCanvas( os::Point( m_Screen.GetResolution() ) );
pcBitmapImage = new os::BitmapImage((uint8*)m_Screen.GetFrameBuffer(),m_Screen.GetResolution(),m_Screen.GetColorSpace());
pcBitmapImage->Draw( os::Point( 0, 0 ), pcSaveImage->GetView() );
pcSaveImage->Sync();
cScreenShotPath = os::String().Format("%s/Pictures/Screenshot-%d-%d-%d-%d_%d_%d.png",getenv("HOME"),pcTime.GetYear(),pcTime.GetMonth(),pcTime.GetDay(),pcTime.GetHour(),pcTime.GetMin(),pcTime.GetSec());
File vNewFile = os::File(cScreenShotPath,O_CREAT | O_TRUNC | O_WRONLY);
vNewFile.WriteAttr("os::MimeType", O_TRUNC, ATTR_TYPE_STRING,"image/png", 0,10 );
pcSaveImage->Save(&vNewFile,"image/png");
vNewFile.Flush();
delete( pcSaveImage );
delete pcBitmapImage;
RemoveTimer(this,nID);
}
}
示例7: DiskLog
VOID CLogFile::DiskLog(enum_LOG_LEVEL logLevel, const CHAR* pLogString , ...)
{
//等级太低,不需打印控制台和文件
if (logLevel < m_eConsoleLogLevel && logLevel < m_eFileLogLevel)
{
return ;
}
CHAR szLine[MAX_LOG_LINE] = {0};
va_list va;
va_start(va,pLogString);
#ifdef __LINUX
vsprintf(szLine,pLogString,va);
#else
vsprintf_s(szLine,MAX_LOG_LINE,pLogString,va);
#endif
va_end(va);
DateTime now;
CHAR szLogStr[MAX_LOG_LINE] = {'\0'};
_snprintf(szLogStr, MAX_LOG_LINE, "%2d/%02d/%02d %02d:%02d:%02d.%03d tId:%ld %s\n",
now.GetYear(),
now.GetMonth(),
now.GetDay(),
now.GetHour(),
now.GetMinute(),
now.GetSecond(),
now.GetMilliSecond(),
GetThreadID(),
szLine);
//高等与控制台等级,则打印到控制台
if (logLevel >= m_eConsoleLogLevel)
{
printf("%s", szLogStr);
}
//高等与文件等级,则打印到文件
if (logLevel >= m_eFileLogLevel)
{
CSmartLock sLock(m_lock);
INT nLogStrLen = strlen(szLogStr);
if ((m_bBackBufAvailable) &&
(m_pWriteBuf + nLogStrLen - m_pFrontBuf >= LOG_BUF_LEN))
{
//如果back有东西, front还写不下,就要写2次文件了,不过这种情况应该很少
WriteBackBufToFile();
}
if (m_pWriteBuf + nLogStrLen - m_pFrontBuf >= LOG_BUF_LEN)
{
//front写不下,那么back肯定空着
SwitchBuf();
}
//写入front
strcpy( m_pWriteBuf, szLogStr );
m_pWriteBuf += nLogStrLen;
//全写入文件中
WriteAllBufToFile();
}
}
示例8: setRequest
void RouteRequestManager::setRequest(Request* req,bool addToResults_){
addToResults= addToResults_;
__pRequest = req;
String hostAddr = L"http://api.irail.be";
result r = E_SUCCESS;
__pSession = new HttpSession();
r = __pSession->Construct(NET_HTTP_SESSION_MODE_NORMAL, null ,hostAddr,null);
if (IsFailed(r))
AppLogDebug("Construct Session failed. (%s)\n", GetErrorMessage(r));
__pTransaction = __pSession->OpenTransactionN();
if (null == __pTransaction)
AppLogDebug("Construct Session failed. \n");
r = __pTransaction->AddHttpTransactionListener(*this);
if (IsFailed(r))
AppLogDebug("AddHttpTransactionListener Session failed.\n");
__pHttpRequest = __pTransaction->GetRequest();
if(__pHttpRequest == null)
AppLogDebug("GetRequest failed. \n");
String hostAddr2(L"http://api.irail.be/connections/?to=");
hostAddr2.Append(*req->getToStation()->getNameN());
hostAddr2.Append(L"&from=");
hostAddr2.Append(*req->getFromStation()->getNameN());
hostAddr2.Replace(L" ","-");
hostAddr2.Append(L"&typeOfTransport=train");
DateTime* dt = req->getDateTime();
if(dt){
//LocaleManager localeManager;
//localeManager.Construct();
//TimeZone timeZone = localeManager.GetSystemTimeZone();
//DateTime utcDateTime = timeZone.WallTimeToUtcTime(*req->getDateTime());
hostAddr2.Append(L"&date=");
if(dt->GetDay()<10)
hostAddr2.Append(L"0");
hostAddr2.Append(Integer::ToString(dt->GetDay()));
if(dt->GetMonth()<10)
hostAddr2.Append(L"0");
hostAddr2.Append(Integer::ToString(dt->GetMonth()));
String year;
Integer::ToString(dt->GetYear()).SubString(2,year);
hostAddr2.Append(year);
hostAddr2.Append(L"&time=");
if(dt->GetHour()<10)
hostAddr2.Append(L"0");
hostAddr2.Append(Integer::ToString(dt->GetHour()));
if(dt->GetMinute()<10)
hostAddr2.Append(L"0");
hostAddr2.Append(Integer::ToString(dt->GetMinute()));
}
//AppLog("request link: %S",hostAddr2.GetPointer());
r = __pHttpRequest->SetUri(hostAddr2);
if(IsFailed(r))
AppLogDebug("SetUri failed. (%s)\n", GetErrorMessage(r));
r = __pHttpRequest->SetMethod(NET_HTTP_METHOD_GET);
if(IsFailed(r))
AppLogDebug("SetMethod failed. (%s)\n", GetErrorMessage(r));
// Header Setting
HttpHeader* pHttpHeader = null;
pHttpHeader = __pHttpRequest->GetHeader();
if (null == pHttpHeader){
r = GetLastResult();
AppLogDebug("Uri Setting failed. (%s)\n", GetErrorMessage(r));
r = pHttpHeader->AddField(L"Content-Length", L"1024");
if (IsFailed(r))AppLogDebug("Header Setting failed. (%s)\n", GetErrorMessage(r));
}
r = __pTransaction->Submit();
if(IsFailed(r))
AppLogDebug("Submit failed. (%s)\n", GetErrorMessage(r));
//AppLog("request sended");
//TODO delete __pHttpRequest
//TODO delete pHttpHeader
}
示例9: OnActionPerformed
//.........这里部分代码省略.........
__pPanel->Draw();
ischeck_key = false;
ischeck_plus = false;
__pEditField->SetKeypadEnabled(true);
}
}
break;
case IDC_BUTTON_FEEDBACKB:
case IDC_BUTTON_RECORDGO:
popup->SetShowState(true);
popup->Show();
break;
case IDC_BUTTON_FEEDBACKX:
popup->SetShowState(false);
Record_Status=0;
break;
case IDC_BUTTON_RECORDER:
if (Record_Status == 0) {
AppLog("녹음중");
__Record->SetNormalBackgroundBitmap(
*pAppResource->GetBitmapN(L"Record_Start.png"));
__Record->SetHighlightedBackgroundBitmap(
*pAppResource->GetBitmapN(L"Record_Start.png"));
__Record->SetPressedBackgroundBitmap(
*pAppResource->GetBitmapN(L"Record_Start.png"));
__Record->Draw();
popup->RequestRedraw(true);
Record_Status = 1;
DateTime currentTime;
SystemTime::GetCurrentTime(TIME_MODE_WALL, currentTime);
__filename.Format(32, L"%04d%02d%02d_%02d%02d%02d.mp3",
currentTime.GetYear(), currentTime.GetMonth(),
currentTime.GetDay(), currentTime.GetHour(),
currentTime.GetMinute(), currentTime.GetSecond());
__filepath = App::GetInstance()->GetAppDataPath() + __filename;
__audioRecorder.CreateAudioFile(__filepath, true);
__audioRecorder.SetMaxRecordingTime(60000); //60 sec
__audioRecorder.SetQuality(RECORDING_QUALITY_HIGH);
__audioRecorder.SetFormat(CODEC_MP3, MEDIA_CONTAINER_MP3);
__audioRecorder.Record();
__audioDestPath = Tizen::System::Environment::GetMediaPath()
+ __filepath;
} else if (Record_Status == 1) {
AppLog("녹음완료");
__Record->SetNormalBackgroundBitmap(
*pAppResource->GetBitmapN(L"Record_Complete.png"));
__Record->SetHighlightedBackgroundBitmap(
*pAppResource->GetBitmapN(L"Record_Complete.png"));
__Record->SetPressedBackgroundBitmap(
*pAppResource->GetBitmapN(L"Record_Complete.png"));
__Record->Draw();
Record_Status = 2;
__audioRecorder.Stop();
__audioRecorder.Close();
trans_voice->SetNormalBackgroundBitmap(
*pAppResource->GetBitmapN(L"voice_trans2.png"));
trans_voice->SetHighlightedBackgroundBitmap(
*pAppResource->GetBitmapN(L"voice_trans2.png"));
trans_voice->SetPressedBackgroundBitmap(
*pAppResource->GetBitmapN(L"voice_trans2.png"));
trans_voice->Draw();
istransport = true;
} else if (Record_Status == 2) {
AppLog("재생");
__filepath = App::GetInstance()->GetAppDataPath() + __filename;
__player.OpenFile(__filepath);
__player.SetVolume(100);
__player.Play();
}
break;
case IDC_BUTTON_TRANSPORT:
if(istransport == true)
{
trans_voice->SetNormalBackgroundBitmap(
*pAppResource->GetBitmapN(L"voice_trans1.png"));
trans_voice->SetHighlightedBackgroundBitmap(
*pAppResource->GetBitmapN(L"voice_trans1.png"));
trans_voice->SetPressedBackgroundBitmap(
*pAppResource->GetBitmapN(L"voice_trans1.png"));
trans_voice->Draw();
istransport = false;
Toast* to = new Toast();
to->Construct(Rectangle(30,1100 ,660,70), L"음성피드백을 전송하였습니다", 2000);
}
break;
default:
break;
}
}