31static const _TUCHAR sDaysInMonth[12] =
32 { 31,28,31,30,31,30,31,31,30,31,30,31 };
33static const DayTy sFirstDayOfEachMonth[12] =
34 { 1,32,60,91,121,152,182,213,244,274,305,335 };
37static const tchar* DefMonthNames[12] =
38 {
_T(
"January"),
_T(
"February"),
_T(
"March"),
_T(
"April"),
_T(
"May"),
_T(
"June"),
39 _T(
"July"),
_T(
"August"),
_T(
"September"),
_T(
"October"),
_T(
"November"),
_T(
"December") };
40static const tchar* DefUCMonthNames[12] =
41 {
_T(
"JANUARY"),
_T(
"FEBRUARY"),
_T(
"MARCH"),
_T(
"APRIL"),
_T(
"MAY"),
_T(
"JUNE"),
42 _T(
"JULY"),
_T(
"AUGUST"),
_T(
"SEPTEMBER"),
_T(
"OCTOBER"),
_T(
"NOVEMBER"),
_T(
"DECEMBER") };
44static const tchar* DefWeekDayNames[7] =
45 {
_T(
"Monday"),
_T(
"Tuesday"),
_T(
"Wednesday"),
46 _T(
"Thursday"),
_T(
"Friday"),
_T(
"Saturday"),
_T(
"Sunday") };
47static const tchar* DefUCWeekDayNames[7] =
48 {
_T(
"MONDAY"),
_T(
"TUESDAY"),
_T(
"WEDNESDAY"),
49 _T(
"THURSDAY"),
_T(
"FRIDAY"),
_T(
"SATURDAY"),
_T(
"SUNDAY") };
52static const tchar** MonthNames = DefMonthNames;
53static const tchar** UCMonthNames = DefUCMonthNames;
54static const tchar** WeekDayNames = DefWeekDayNames;
55static const tchar** UCWeekDayNames = DefUCWeekDayNames;
89 Julnum = jul1901 +
static_cast<JulTy>(
day);
185 unsigned d = sDaysInMonth[
month-1];
223 return static_cast<JulTy>(0);
234 return ((146097L*
c)>>2) + ((1461*
ya)>>2) + (153*
m + 2)/5 +
d + 1721119L;
242 return ((
year & 3) == 0 && (
year % 100) != 0) || (
year % 400) == 0;
281 if( Julnum <
d.Julnum )
283 else if( Julnum >
d.Julnum )
324 return static_cast<unsigned>(Julnum);
337 JulTy j = Julnum - 1721119L;
338 y = (
YearTy) (((
j<<2) - 1) / 146097L);
339 j = (
j<<2) - 1 - 146097L*y;
341 j = ((
_d<<2) + 3) / 1461;
342 _d = (
_d<<2) + 3 - 1461*
j;
345 _d = 5*
_d - 3 - 153*
m;
363 return dt.Julnum > Julnum ?
dt : *
this;
372 return dt.Julnum < Julnum ?
dt : *
this;
476 TProfile p(
_T(
"intl"));
513 const tchar***
Names[] = { &MonthNames, &UCMonthNames,
514 &WeekDayNames, &UCWeekDayNames,
517 (
const tchar***)&DefMonthNames, (
const tchar***)&DefUCMonthNames,
518 (
const tchar***)&DefWeekDayNames, (
const tchar***)&DefUCWeekDayNames,
532 const tchar**
Names[] = { MonthNames, UCMonthNames,
533 WeekDayNames, UCWeekDayNames,
The TDate class represents a date.
YearTy Year() const
Returns the year of this TDate.
static int LeapYear(YearTy year)
unsigned Hash() const
Returns a hash value for the date.
int DaysInMonth(MonthTy month=0) const
TDate()
Construct a TDate with the current date.
static LPCTSTR MonthName(MonthTy monthNumber)
Returns the string name for the given monthNumber (1-12).
static int AssertIndexOfMonth(MonthTy m)
Returns 1 if m is between 1 and 12 inclusive, otherwise returns 0.
int Leap() const
leap year?
static DayTy DaysInYear(YearTy)
Returns the number of days in the year specified (365 or 366).
TDate Max(const TDate &dt) const
Compares this TDate with dt and returns the date with the greater Julian number.
int CompareTo(const TDate &) const
Returns 1 if the target TDate is greater than parameter TDate, -1 if the target is less than the para...
static int AssertWeekDayNumber(DayTy d)
Returns 1 if d is between 1 and 7 inclusive, otherwise returns 0.
static MonthTy IndexOfMonth(const tstring &monthName)
Returns the number, 1-12, of the month named nameOfMonth.
static LPCTSTR DayName(DayTy weekDayNumber)
Returns a string name for the weekday number.
DayTy FirstDayOfMonth() const
Returns the number of the first day of the month for this TDate.
static void SetIntlNames(TDateType type, const tchar **names)
static const tchar * GetIntlName(TDateType type, int index)
MonthTy Month() const
Returns the month of this TDate.
TSystemTime GetSystemTime() const
static int DayWithinMonth(MonthTy, DayTy, YearTy)
Returns 1 if the given day (1-31) is within the given month for the given year.
DayTy WeekDay(DayTy day=0) const
Returns 1 (Monday) through 7 (Sunday).
TDate Min(const TDate &dt) const
Compares this TDate with dt and returns the date with the lesser Julian number.
static DayTy DayOfWeek(const tstring &dayName)
Return the number, 1-7, of the day of the week named nameOfDay.
DayTy Day() const
Returns the day of the year (1-365).
static JulTy Jday(MonthTy, DayTy, YearTy)
Convert Gregorian calendar date to the corresponding Julian day number j.
TDate Previous(const tstring &dayName) const
Return date of previous dayName.
DayTy DayOfMonth() const
Returns the day (1-31) of the month of this TDate.
TSystemTime is a class derived from the structure SYSTEMTIME.
static TSystemTime LocalTime()
The TTime class encapsulates time functions and characteristics.
int IsValid() const
Returns 1 if this TTime object contains a valid time, 0 otherwise.
Object Windows Library (OWLNext Core)
const uint32 SECONDS_IN_DAY
unsigned YearTy
Year type.
TTime operator+(const TTime &t, long s)
Adds s seconds to time t.
TTime operator-(const TTime &t, long s)
Performs subtraction, in seconds, between s and t.
unsigned long JulTy
Julian calendar type.
FindMatch(const tchar *str, const tchar **candidates, int icand)
const tchar ** candidates
unsigned MonthTy
Month type.
#define _OWLSTATICFUNC(p)
Definition of TProfile class.
Definition of class TString, a flexible universal string envelope class.
Classes for window system structure and type encapsulation.