Exemplo n.º 1
0
DateTime::DateTime()
{
	Timestamp now;
	_utcTime = now.utcTime();
	computeGregorian(julianDay());
	computeDaytime();
}
Exemplo n.º 2
0
DateTime& DateTime::operator = (const Timestamp& timestamp)
{
	_utcTime = timestamp.utcTime();
	computeGregorian(julianDay());
	computeDaytime();
	return *this;
}
Exemplo n.º 3
0
DateTime& DateTime::operator -= (const Timespan& span)
{
	_utcTime -= span.totalMicroseconds()*10;
	computeGregorian(julianDay());
	computeDaytime();
	return *this;
}
Exemplo n.º 4
0
DateTime& DateTime::operator += (const Timespan& span)
{
    _utcTime += span*10;
    computeGregorian(julianDay());
    computeDaytime();
    return *this;
}
Exemplo n.º 5
0
static int weekNumber(const Date *theDate) {
	int J = julianDay(theDate);
	
	int d4 = (J+31741-(J%7))%146097%36524%1461;
	int L = (int)(d4/1460);
	int d1 = ((d4-L)%365)+L;
	
	return (int)(d1/7)+1;
}
Exemplo n.º 6
0
bool Date::setDate (int year, int month, int day)
{
    if (isValid(year, month, day))
        m_jd = julianDay(year, month, day);
    else
        m_jd = NullJulianDay;

    return isValid();
}
Exemplo n.º 7
0
static int dayOfWeek(const Date *theDate) {
	int J = julianDay(theDate);
	return (J+1)%7;
}
Exemplo n.º 8
0
DateTime::DateTime(const Timestamp& timestamp):
	_utcTime(timestamp.utcTime())
{
	computeGregorian(julianDay());
	computeDaytime();
}
Exemplo n.º 9
0
int DateTime::dayOfWeek() const
{
	return int((std::floor(julianDay() + 1.5))) % 7;
}
Exemplo n.º 10
0
DateTime::DateTime(Timestamp::UtcTimeVal utcTime, Timestamp::TimeDiff diff):
	_utcTime(utcTime + diff*10)
{
	computeGregorian(julianDay());
	computeDaytime();
}
Exemplo n.º 11
0
/**
 * @brief Returns the day of the year (1 to 365 or 366 on leap years) for
          this date.
 *
 * @return The day of the year (1 to 365 or 366 on leap years) for
    this date, or 0 if the date is invalid.
 */
int Date::dayOfYear() const
{
    return !isValid()
        ? 0
        : m_jd - julianDay(year(), 1, 1) + 1;
}