Example #1
0
const char *
DateRangeDaily::error( void ) const
{
  static Str errStr;
  errStr.reset();

  errStr << getClassName() << ":";

  
  if( good() )
    {
      errStr << "Ok";
    }
  else
    {
      if( ! DateRange::good() )
	{
	  errStr << ' ' << DateRange::error();
	}

      if( ! (getTimeT() >= 0 ) )
	{
	  errStr << " start < 0";
	}

      if( ! (getTimeT() < SecPerDay ) )
	{
	  errStr << " start >= 1 day";
	}
    }
  return( errStr.cstr() );
}
Example #2
0
time_t
DateRangeDaily::startsIn( const DateRange & dateTwo ) const
{
  time_t  secs = 0;
  
  if( dateTwo.getSecOfDay() >= getTimeT() &&
      dateTwo.getSecOfDay() <= getTimeT() + dur )
    {
      secs = secIn( dateTwo );
    }
  return( secs );
}
Example #3
0
time_t
DateRange::startsIn( const DateRange & dateTwo ) const
{
  time_t  secs = 0;

  if( dateTwo.getTimeT() >= getTimeT() &&
      dateTwo.getTimeT() <= (getTimeT() + dur ) )
    {
      secs = secIn( dateTwo );
    }
  return( secs );
}
Example #4
0
time_t
DateRangeDaily::secIn( const DateRange & dateTwo ) const
{
  return( UnionOfDur( getTimeT(), dur,
		      dateTwo.getSecOfDay(), dateTwo.getDur(),
		      getFrequency() ) );
}
Example #5
0
//defaultparse:处理常见时间格式,如时间戳、1980-2-4 am 3:40 、1980-2-4  3:40 am …… 
bool CDateTime::defaultparse(const char *timestring)
{
#ifdef __FOR_WIN__
	time_t times;
	if(IsTime_T(timestring,times))
	{
		this->sStamp = times;
		this->sTm = localtime_r(&sStamp,&sc);
		return true;
	}else{
		COleDateTime tmptime(sStamp);
		try {
			if (tmptime.ParseDateTime(timestring))
			{
				sStamp = getTimeT(tmptime);
				if (sStamp == -1) {
					sStamp = time(NULL);
					return false;
				}
				this->sTm = localtime_r(&sStamp,&sc);
				return true;
			}
		} catch(...) {
			sTm->tm_isdst = 0;
			sTm->tm_wday = 0;
			sTm->tm_yday = 0;
			return false;	
		}
	}
	sTm->tm_isdst = 0;
	sTm->tm_wday = 0;
	sTm->tm_yday = 0;
#endif
	return false;
}
Example #6
0
time_t
DateRange::secIn( const DateRange & dateTwo ) const
{
  time_t   secs = 0;

  return( UnionOfDur( getTimeT(), dur,
		      dateTwo.getTimeT(), dateTwo.getDur() ) );
  
  return( secs );
}
Example #7
0
time_t
DateRangeDaily::getStart( void ) const
{
  return( getTimeT() );
}
Example #8
0
time_t
DateRangeDaily::getSecOfDay( void ) const
{
  return( SecOfDay( getTimeT() ) );
}
Example #9
0
bool
DateRangeDaily::good( void ) const
{
  return( DateRange::good() &&
	  getTimeT() >= 0 && getTimeT() < SecPerDay );
}
Example #10
0
bool
DateRange::isIn( const DateTime & dateTwo ) const
{
  return( getTimeT() <= dateTwo.getTimeT()
	  && dateTwo.getTimeT() <= (getTimeT() + getDur() ) );
}