Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

sword::CalendarGregorian Class Reference

Gregorian Calendar implementation. More...

Inheritance diagram for sword::CalendarGregorian:

sword::CalendarWestern sword::Calendar

Public Methods

virtual bool isValid (word day, word month, word year, word hour, word minute, word second, word millisecond) const
 Validates a 'dmy h:m:s' date value within this Calendar.

virtual bool isLeapYear (word year) const
 Checks whether a year is a leap year or not.

virtual int64 daysInMonth (word month, word year) const
 Computes the number of days in a month.

virtual int64 daysInYear (word year) const
 Computes the number of days in a year.

virtual int64 daysWithinYear (word day, word month, word year) const
 Computes the number of this day within its year (Jan 1st returns 0).

virtual int64 daysBeforeYear (word year) const
 Number of days from 1/1/1601 to 1/1/year.

virtual word weekDay (Time time) const
 Computes the day of the week (0=Sunday to 6=Saturday).

virtual Time easter (word year) const
 Computes the easter date for a given year.

virtual int64 dmy2days_ (word day, word month, word year) const
 Number of days to day/month/year.

virtual void days2dmy_ (int64 days, word &day, word &month, word &year) const
 Computes the day/month/year from the number of days.

virtual void convert (Time time, word &day, word &month, word &year, word &hour, word &minute, word &second, word &millisecond) const
 Converts a timestamp into a full 'dmy h:m:s' date value.

virtual void convert (Time time, word &day, word &month, word &year) const
 Converts a timestamp into a 'dmy' date value.

virtual Time convert (word day, word month, word year, word hour, word minute, word second, word millisecond) const
 Converts a full 'dmy h:m:s' date value into a timestamp.

virtual Time convert (word day, word month, word year) const
 Converts a 'dmy' date value into a timestamp (assuming hour is 0:0:0).


Detailed Description

Gregorian Calendar implementation.

The Gregorian calendar is the usual Time / Date referential for western cultures. It is used since 1582 and specifies correctly the leap years in order to compensate the earth revolution time around the sun (a year is a leap year if it is multiple of 4, but not multiple of 100 except if it is also a multiple of 400).

This implementation is inspired from the free software source code there: http://waysysweb.com/COM/Waysys/util/WayDate.txt

Warning:
internally, computation are performed on number of days since 1/1/1601, not since 1/1/1970 !
See also:
CalendarJulian


Member Function Documentation

virtual Time sword::CalendarWestern::convert word    day,
word    month,
word    year
const [virtual, inherited]
 

Converts a 'dmy' date value into a timestamp (assuming hour is 0:0:0).

Implements sword::Calendar.

virtual Time sword::CalendarWestern::convert word    day,
word    month,
word    year,
word    hour,
word    minute,
word    second,
word    millisecond
const [virtual, inherited]
 

Converts a full 'dmy h:m:s' date value into a timestamp.

Implements sword::Calendar.

virtual void sword::CalendarWestern::convert Time    time,
word &    day,
word &    month,
word &    year
const [virtual, inherited]
 

Converts a timestamp into a 'dmy' date value.

Implements sword::Calendar.

virtual void sword::CalendarWestern::convert Time    time,
word &    day,
word &    month,
word &    year,
word &    hour,
word &    minute,
word &    second,
word &    millisecond
const [virtual, inherited]
 

Converts a timestamp into a full 'dmy h:m:s' date value.

Implements sword::Calendar.

virtual void sword::CalendarGregorian::days2dmy_ int64    days,
word &    day,
word &    month,
word &    year
const [virtual]
 

Computes the day/month/year from the number of days.

Implements sword::Calendar.

virtual int64 sword::CalendarGregorian::daysBeforeYear word    year const [virtual]
 

Number of days from 1/1/1601 to 1/1/year.

Implements sword::CalendarWestern.

virtual int64 sword::CalendarGregorian::daysInMonth word    month,
word    year
const [virtual]
 

Computes the number of days in a month.

Implements sword::CalendarWestern.

virtual int64 sword::CalendarGregorian::daysInYear word    year const [virtual]
 

Computes the number of days in a year.

Implements sword::CalendarWestern.

virtual int64 sword::CalendarGregorian::daysWithinYear word    day,
word    month,
word    year
const [virtual]
 

Computes the number of this day within its year (Jan 1st returns 0).

Implements sword::CalendarWestern.

virtual int64 sword::CalendarGregorian::dmy2days_ word    day,
word    month,
word    year
const [virtual]
 

Number of days to day/month/year.

Implements sword::Calendar.

virtual Time sword::CalendarGregorian::easter word    year const [virtual]
 

Computes the easter date for a given year.

Implements sword::CalendarWestern.

virtual bool sword::CalendarGregorian::isLeapYear word    year const [virtual]
 

Checks whether a year is a leap year or not.

Implements sword::CalendarWestern.

virtual bool sword::CalendarGregorian::isValid word    day,
word    month,
word    year,
word    hour,
word    minute,
word    second,
word    millisecond
const [virtual]
 

Validates a 'dmy h:m:s' date value within this Calendar.

Implements sword::Calendar.

virtual word sword::CalendarGregorian::weekDay Time    time const [virtual]
 

Computes the day of the week (0=Sunday to 6=Saturday).

Implements sword::CalendarWestern.


Generated on Tue Dec 23 20:08:56 2003 for SWORD by doxygen1.3-rc2