本文整理汇总了C++中AbsSecs函数的典型用法代码示例。如果您正苦于以下问题:C++ AbsSecs函数的具体用法?C++ AbsSecs怎么用?C++ AbsSecs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AbsSecs函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: IAssert
TSecTm TSecTm::Round(const TTmUnit& TmUnit) const {
if (TmUnit == tmu1Sec) { return *this; }
struct tm Time;
IAssert(IsDef() && GetTmStruct(AbsSecs(), Time));
switch (TmUnit) {
case tmu1Min : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, Time.tm_min, 0);
case tmu10Min : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 10*(Time.tm_min/10), 0);
case tmu15Min : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 15*(Time.tm_min/15), 0);
case tmu30Min : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 30*(Time.tm_min/30), 0);
case tmu1Hour : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, Time.tm_hour, 0, 0);
case tmu2Hour : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 2*(Time.tm_hour/2), 0, 0);
case tmu4Hour : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 4*(Time.tm_hour/4), 0, 0);
case tmu6Hour : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 6*(Time.tm_hour/6), 0, 0);
case tmu12Hour : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 12*(Time.tm_hour/12), 0, 0);
case tmuDay : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, Time.tm_mday, 0, 0, 0);
case tmuMonth : return TSecTm(Time.tm_year+1900, Time.tm_mon+1, 1, 0, 0, 0);
case tmuYear : return TSecTm(Time.tm_year+1900, 1, 1, 0, 0, 0);
case tmuWeek : { int dd=1, mm=1, yy=1;
// week starts on Thursday, since 1.1.1970 is Thursday
const int Day = TJulianDate::GetJulianDateN(Time.tm_mday, Time.tm_mon+1, 1900+Time.tm_year);
TJulianDate::GetCalendarDate(3+7*(Day/7), dd, mm, yy); return TSecTm(yy, mm, dd, 0, 0, 0); }
default : Fail;
}
return TSecTm();
}
开发者ID:Networks-Learning,项目名称:infopath,代码行数:25,代码来源:tm.cpp
示例2: EAssert
void TSecTm::GetComps(int& Year, int& Month, int& Day, int& Hour, int& Min, int& Sec) const {
struct tm Tm;
EAssert(IsDef() && GetTmStruct(AbsSecs(), Tm));
Year = Tm.tm_year+1900;
Month = Tm.tm_mon+1;
Day = Tm.tm_mday;
Hour = Tm.tm_hour;
Min = Tm.tm_min;
Sec = Tm.tm_sec;
}
开发者ID:jethrotan,项目名称:qminer,代码行数:10,代码来源:tm.cpp
注:本文中的AbsSecs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论