本文整理汇总了C++中LocalDateTime类的典型用法代码示例。如果您正苦于以下问题:C++ LocalDateTime类的具体用法?C++ LocalDateTime怎么用?C++ LocalDateTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LocalDateTime类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTimeInSeconds
//----------------------------------------------------------------------------
void ServerLoop::Run()
{
double lastReportTimeTime = GetTimeInSeconds();
int cursaveday = -1;
while (!mIsShutdownServer)
{
double curTime = GetTimeInSeconds();
if (curTime - lastReportTimeTime > 600.0)
{
// 每10分钟向帐号服务器汇报状态
lastReportTimeTime = curTime;
// 每天3点保存角色数据
LocalDateTime time;
int hour = time.Hour();
int day = time.Day();
if (3 == hour && mCurDay != day)
{
// save
}
}
System::SleepSeconds(0.1f);
}
}
示例2: setDate
//----------------------------------------------------------------------------//
void AstmField::setDate(const LocalDateTime &val, const int &index, const int &repeatedIndex)
{
char output[18];
#if defined(POCO_OS_FAMILY_WINDOWS)
_snprintf_s(output, 16, "%04d%02d%02d", val.year(), val.month(), val.day());
#else
snprintf(output, 16, "%04d%02d%02d", val.year(), val.month(), val.day());
#endif
checkIndex(index, repeatedIndex, true);
_items[index + repeatedIndex * _componentSize] = output;
}
示例3: append
void DateTimeFormatter::append(std::string& str, const LocalDateTime& dateTime, const std::string& fmt)
{
DateTimeFormatter::append(str, dateTime.utc(), fmt, dateTime.tzd());
}
示例4: InitializeNetwork
//----------------------------------------------------------------------------
bool ServerLoop::Initlize()
{
InitializeNetwork();
time_t ti; time(&ti); srand((unsigned int)ti);
#ifdef PX2_USE_MEMORY
Memory::Initialize();
#endif
StringHelp::Initlize();
FString::Initlize();
Logger *logger = new0 Logger();
#if defined(_WIN32) || defined(WIN32)
logger->AddFileHandler("log_server.txt", LT_INFO | LT_ERROR | LT_USER);
#endif
logger->AddOutputWindowHandler(LT_INFO | LT_ERROR | LT_USER);
logger->AddConsoleHandler(LT_INFO | LT_ERROR | LT_USER);
logger->SetLogFileInfo(false);
logger->StartLogger();
LocalDateTime time;
int year1 = time.Year();
int month1 = time.Month();
int week1 = time.Week();
int dayOfMonth1 = time.Day();
int dayOfWeek1 = time.DayOfWeek();
int dayOfYear1 = time.DayOfYear();
int hour1 = time.Hour();
int minute1 = time.Minute();
int second1 = time.Second();
int millisecond1 = time.Millisecond();
int microsecond1 = time.Microsecond();
PX2_LOG_INFO("Y:%d; M:%d; W:%d; DayfMonth:%d; DayOfWeek:%d; H:%d; M:%d; S:%d; Milli:%d; MicroS:%d",
year1, month1, week1, dayOfMonth1, dayOfWeek1, hour1, minute1, second1, millisecond1, microsecond1);
return true;
}
示例5: time
//----------------------------------------------------------------------------
bool EngineLoop::Initlize()
{
time_t ti; time(&ti); srand((unsigned int)ti);
#ifdef PX2_USE_MEMORY
Memory::Initialize();
#endif
StringHelp::Initlize();
FString::Initlize();
Logger *logger = new0 Logger();
#if defined(_WIN32) || defined(WIN32)
logger->AddFileHandler("PX2Application_Log.txt", LT_INFO | LT_ERROR | LT_USER);
#endif
logger->AddOutputWindowHandler(LT_INFO | LT_ERROR | LT_USER);
logger->StartLogger();
LocalDateTime time;
int year1 = time.Year();
int month1 = time.Month();
int week1 = time.Week();
int day1 = time.Day();
int dayOfWeek1 = time.DayOfWeek();
int dayOfYear1 = time.DayOfYear();
int hour1 = time.Hour();
int minute1 = time.Minute();
int second1 = time.Second();
int millisecond1 = time.Millisecond();
int microsecond1 = time.Microsecond();
PX2_LOG_INFO("Year:%d; Month:%d; Week:%d; Day:%d; DayOfWeek:%d; DayOfYear:%d; Hour:%d; Minute:%d; Second:%d; Millisecond:%d; Microsecond:%d",
year1, month1, week1, day1, dayOfWeek1, dayOfYear1, hour1, minute1, second1, millisecond1, microsecond1);
mTimerMan = new0 TimerManager();
mIMEDisp = new0 IMEDispatcher();
mInputMan = new0 InputManager();
mLanguageMan = new0 LanguageManager();
mResMan = new0 ResourceManager();
//PX2_LM.Add("Data/engine/engineLanguage.csv");
mEventWorld = new0 EventWorld();
mScriptMan = new0 LuaManager();
mRoot = new0 GraphicsRoot();
mRoot->Initlize();
mFontMan = new0 FontManager();
PX2_UNUSED(mFontMan);
mADMan = new0 AddDeleteManager();
PX2_UNUSED(mADMan);
mSelection = new0 Selection();
PX2_UNUSED(mSelection);
mCreater = new0 Creater();
PX2_UNUSED(mCreater);
mURDoMan = new0 URDoManager();
PX2_UNUSED(mURDoMan);
mAccoutManager = new0 AccoutManager();
LuaManager *luaMan = (LuaManager*)mScriptMan;
tolua_PX2_open(luaMan->GetLuaState());
mScriptMan->SetUserTypePointer("PX2_ENGINELOOP", "EngineLoop", this);
mScriptMan->SetUserTypePointer("PX2_LOG", "Logger", Logger::GetSingletonPtr());
mScriptMan->SetUserTypePointer("PX2_LM", "LanguageManager", &(PX2_LM));
mScriptMan->SetUserTypePointer("PX2_RM", "ResourceManager", ResourceManager::GetSingletonPtr());
mScriptMan->SetUserTypePointer("PX2_SM", "ScriptManager", ScriptManager::GetSingletonPtr());
mScriptMan->SetUserTypePointer("PX2_SELECTION", "Selection", Selection::GetSingletonPtr());
mScriptMan->SetUserTypePointer("PX2_CREATER", "Creater", Creater::GetSingletonPtr());
mScriptMan->SetUserTypePointer("PX2_URM", "URDoManager", URDoManager::GetSingletonPtr());
LoadBoost("Data/boost.xml");
return true;
}
示例6: Timespan
Timespan LocalDateTime::operator - (const LocalDateTime& dateTime) const
{
return Timespan((utcTime() - dateTime.utcTime())/10);
}
示例7: utcTime
bool LocalDateTime::operator >= (const LocalDateTime& dateTime) const
{
return utcTime() >= dateTime.utcTime();
}
示例8: main
int main(int argc, char **argv)
{
if (argc < 3)
{
cout << "Uage:" << argv[0] << " [ -f ] <src server > <save file >" << endl;
exit(0);
}
signal(SIGHUP, sigroutine); //* 下面设置三个信号的处理方法
signal(SIGINT, sigroutine);
signal(SIGQUIT, sigroutine);
bool dfps = false;
int postion = 0;
if (argc == 4 && (string(argv[1]) == string("-f")))
{
postion++;
dfps = true;
}
NetH264Reader reader(argv[postion + 1]);
FILE *out;
cout << "connect server " << argv[postion + 1] << endl;
if (reader.open())
{
cout << "connect server " << argv[postion + 1] << " sucess" << endl;
out = fopen(argv[postion + 2], "wb");
if (out)
{
H264NALU *nalu = 0;
char naluHead[] =
{ 0x0, 0x0, 0x0, 0x1 };
int time = LocalDateTime().second();
int fps = 0;
while (run)
{
nalu = reader.readH264();
if (nalu != 0)
{
if (dfps)
{
if (LocalDateTime().second() == time)
{
fps++;
}
else
{
LocalDateTime ld;
cout << ld.year() << "-" << ld.month() << "-" << ld.day() << " " << ld.hour() << ":" << ld.minute() << ":" << ld.second() << " recevie fps:" << fps
<< endl;
fps = 1;
time = LocalDateTime().second();
}
}
fwrite(naluHead, 4, 1, out);
fwrite(nalu->getData(), nalu->getLength(), 1, out);
}
else
{
cout << "disconnet server " << endl;
break;
}
}
fclose(out);
out = NULL;
}
else
{
cout << "open file " << argv[postion + 2] << " error" << endl;
}
}
else
{
cout << "connect server " << argv[postion + 1] << " fail" << endl;
}
}