示例#1
0
文件: tm.cpp 项目: jethrotan/qminer
TStr TSecTm::GetDayPart() const {
  const int Hour = GetHourN();
  if (0 <= Hour && Hour < 6) { return "Night"; }
  else if (6 <= Hour && Hour < 12) { return "Morning"; }
  else if (12 <= Hour && Hour < 18) { return "Afternoon"; }
  else if (18 <= Hour && Hour < 24) { return "Evening"; }
  return "";
}
示例#2
0
TStr TSecTm::GetDtTmSortFNmStr() const {
  return
    TInt::GetStr(GetYearN(), "%04d")+"-"+
    TInt::GetStr(GetMonthN(), "%02d")+"-"+
    TInt::GetStr(GetDayN(), "%02d")+"_"+
    TInt::GetStr(GetHourN(), "%02d")+"-"+
    TInt::GetStr(GetMinN(), "%02d")+"-"+
    TInt::GetStr(GetSecN(), "%02d");
}
示例#3
0
PXmlTok TSecTm::GetXmlTok() const {
  PXmlTok NodeTok = TXmlTok::New("NodeTime");
  NodeTok->AddArg("Year", GetYearN());
  NodeTok->AddArg("Month", GetMonthN());
  NodeTok->AddArg("Day", GetDayN());
  NodeTok->AddArg("Hour", GetHourN());
  NodeTok->AddArg("Min", GetMinN());
  NodeTok->AddArg("Sec", GetSecN());
  return NodeTok;
}
示例#4
0
TStr TSecTm::GetStr(const TTmUnit& TmUnit) const {
  if (TmUnit == tmuYear) {
    return TInt::GetStr(GetYearN()); }
  else if (TmUnit == tmuMonth) {
    return TStr::Fmt("%04d-%02d", GetYearN(), GetMonthN()); }
  else if (TmUnit == tmuDay) {
    return TStr::Fmt("%04d-%02d-%02d", GetYearN(), GetMonthN(), GetDayN()); }
  else {
    return TStr::Fmt("%04d-%02d-%02d %02d:%02d:%02d",
      GetYearN(), GetMonthN(), GetDayN(), GetHourN(), GetMinN(), GetSecN());
  }
}