本文整理汇总了C++中DateTime::Hour方法的典型用法代码示例。如果您正苦于以下问题:C++ DateTime::Hour方法的具体用法?C++ DateTime::Hour怎么用?C++ DateTime::Hour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime
的用法示例。
在下文中一共展示了DateTime::Hour方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsSet
bool WorkTime::IsSet() const
{
MYSQL_RES* res;
string sql;
DateTime* dayStart = new DateTime();
DateTime* dayEnd = new DateTime();
dayStart->Hour(0);
dayStart->Minute(0);
dayStart->Minute(0);
dayStart->DateToTimestamp();
dayEnd->Hour(23);
dayEnd->Minute(59);
dayEnd->Seconds(59);
dayEnd->DateToTimestamp();
sql = "SELECT `id` FROM `" + this->table + "` WHERE "
+ "`user` = " + NumberToStringConverter<int>::Convert(this->GetUser()->GetId()) + " "
+ "AND `day` > " + NumberToStringConverter<int>::Convert(dayStart->Timestamp()) + " "
+ "AND `day` < " + NumberToStringConverter<int>::Convert(dayEnd->Timestamp()) + " "
+ "LIMIT 0, 2";
res = this->connector->Query(sql, SELECT);
if(mysql_num_rows(res) != 0) {
return true;
}
else {
return false;
}
}
示例2: DateTime
DateTime operator+ (const DateTime& first, const YearMonthDuration& second)
{
int year = first.Year();
int month = first.Month() - 1;
int day = first.Day();
month += second.Months();
int monthrem = month % 12;
if (monthrem < 0)
{
monthrem += 12;
}
year += second.Years() + (month - monthrem) / 12;
month = monthrem;
if (DateTime::IsLeapYear(year))
{
if (day > (int) monthStartLeap[month + 1] - (int) monthStartLeap[month])
day = (int) monthStartLeap[month + 1] - (int) monthStartLeap[month];
}
else
{
if (day > (int) monthStart[month + 1] - (int) monthStart[month])
day = (int) monthStart[month + 1] - (int) monthStart[month];
}
return DateTime(year, month + 1, day, first.Hour(), first.Minute(), first.Second(), first.Timezone());
}
示例3: CalcUT
/// calculates universal time from DateTime
double CalcUT(const DateTime& dt)
{
unsigned int uiSeconds = dt.Hour() * 3600 + dt.Minute() * 60 + dt.Second();
double UT = uiSeconds / 3600.0;
return UT;
}
示例4: Initlize
//----------------------------------------------------------------------------
bool ApplicationBase::Initlize ()
{
if (msIsInitlized)
return true;
// srand
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();
InitializeNetwork();
DateTime 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);
PX2_LOG_INFO("Begin ApplicationBase::Initlize.");
mTimerMan = new0 TimerManager();
mIMEDisp = new0 IMEDispatcher();
PX2_UNUSED(mIMEDisp);
mLanguageMan = new0 LanguageManager();
mResMan = new0 ResourceManager();
PX2_LM.Add("Data/engine/engineLanguage.csv");
mEventWorld = new0 EventWorld();
mEventWorld->ComeIn(this);
#if defined (PX2_LUA)
mScriptMan = ScriptManager::Create(ScriptManager::ST_LUA);
LuaManager *luaMan = (LuaManager*)mScriptMan;
tolua_PX2_open(luaMan->GetLuaState());
#endif
mScriptEventHandler = new0 ScriptEventHandler();
mEventWorld->ComeIn(mScriptEventHandler);
mRoot = new0 GraphicsRoot();
mRoot->Initlize();
//mDBM = new0 DynamicBufferManager();
//mDBM->Initlize();
mGameMan = new0 GameManager();
mGameMan->LoadBoost("Data/boost.xml");
int width = mGameMan->GetBoostWidth();
int height = mGameMan->GetBoostHeight();
#ifdef __MARMALADE__
width = s3eSurfaceGetInt(S3E_SURFACE_DEVICE_WIDTH);
height = s3eSurfaceGetInt(S3E_SURFACE_DEVICE_HEIGHT);
#endif
std::string projPath = mGameMan->GetProjectPath();
if (0!=width && 0!=height)
{
mWidth = width;
mHeight = height;
}
mInputEventAdapter = new0 InputEventAdapter(); // input manager created in it
mInputEventAdapter->Convert2Touch(true);
mFontMan = new0 FontManager();
PX2_UNUSED(mFontMan);
mUIManager = new0 UIManager();
mEventWorld->ComeIn(mUIManager);
mInputEventAdapter->GetInputEventListener()->AddHandler(mUIManager->GetDefaultView());
SoundSystemInitInfo info;
info.MaxChannels = 24;
info.DopplerScale = 1.0f;
//.........这里部分代码省略.........