Ejemplo n.º 1
0
void CDateTimeSpan::SetFromTimeString(const std::string& time) // hh:mm
{
    if (time.size() >= 5 && time[2] == ':')
    {
        int hour    = atoi(time.substr(0, 2).c_str());
        int minutes = atoi(time.substr(3, 2).c_str());
        SetDateTimeSpan(0,hour,minutes,0);
    }
}
Ejemplo n.º 2
0
void CDateTimeSpan::SetFromPeriod(const std::string &period)
{
    long days = atoi(period.c_str());
    // find the first non-space and non-number
    size_t pos = period.find_first_not_of("0123456789 ", 0);
    if (pos != std::string::npos)
    {
        std::string units = period.substr(pos, 3);
        if (StringUtils::EqualsNoCase(units, "wee"))
            days *= 7;
        else if (StringUtils::EqualsNoCase(units, "mon"))
            days *= 31;
    }

    SetDateTimeSpan(days, 0, 0, 0);
}
Ejemplo n.º 3
0
void CDateTimeSpan::SetFromPeriod(const CStdString &period)
{
  long days = atoi(period.c_str());
  // find the first non-space and non-number
  int pos = period.find_first_not_of("0123456789 ", 0);
  if (pos >= 0)
  {
    CStdString units = period.Mid(pos, 3);
    if (units.CompareNoCase("wee") == 0)
      days *= 7;
    else if (units.CompareNoCase("mon") == 0)
      days *= 31;
  }

  SetDateTimeSpan(days, 0, 0, 0);
}
Ejemplo n.º 4
0
TimeSpan::TimeSpan(int iHours, int iMins, int iSecs, int iMillisecs) throw()
:m_spImpl(new TimeSpanImpl)
{
   SetDateTimeSpan(iHours, iMins, iSecs, iMillisecs);
}
Ejemplo n.º 5
0
CDateTimeSpan::CDateTimeSpan(int day, int hour, int minute, int second)
{
    SetDateTimeSpan(day, hour, minute, second);
}
Ejemplo n.º 6
0
void CDateTimeSpan::SetFromTimeString(const CStdString& time) // hh:mm
{
  int hour    = atoi(time.Mid(0,2).c_str());
  int minutes = atoi(time.Mid(3,2).c_str());
  SetDateTimeSpan(0,hour,minutes,0);
}