RexxDateTime Class Reference

#include <RexxDateTime.hpp>

Public Member Functions

 RexxDateTime ()
 
 RexxDateTime (int64_t basetime)
 
 RexxDateTime (wholenumber_t basedate, bool dummy)
 
 RexxDateTime (wholenumber_t year, wholenumber_t month, wholenumber_t day)
 
 RexxDateTime (wholenumber_t year, wholenumber_t month, wholenumber_t day, wholenumber_t hour, wholenumber_t minutes, wholenumber_t seconds, wholenumber_t microseconds)
 
bool isLeapYear ()
 
wholenumber_t getBaseDate ()
 
wholenumber_t getTimeSeconds ()
 
int64_t getBaseTime ()
 
int64_t getUTCBaseTime ()
 
int64_t getUnixTime ()
 
wholenumber_t getYearDay ()
 
wholenumber_t getWeekDay ()
 
const char * getMonthName ()
 
const char * getDayName ()
 
bool setBaseDate (wholenumber_t basedays)
 
bool setBaseTime (int64_t basetime)
 
bool setUnixTime (int64_t basetime)
 
void setTimeInSeconds (wholenumber_t basetime)
 
void clear ()
 
void setDate (wholenumber_t newYear, wholenumber_t newDay)
 
void setDay (wholenumber_t basedays)
 
bool parseNormalDate (const char *date, const char *sep)
 
bool parseStandardDate (const char *date, const char *sep)
 
bool parseEuropeanDate (const char *date, const char *sep, wholenumber_t currentYear)
 
bool parseUsaDate (const char *date, const char *sep, wholenumber_t currentYear)
 
bool parseOrderedDate (const char *date, const char *sep, wholenumber_t currentYear)
 
bool parseNormalTime (const char *date)
 
bool parseCivilTime (const char *date)
 
bool parseLongTime (const char *date)
 
bool setHours (wholenumber_t h)
 
bool setSeconds (wholenumber_t s)
 
bool setMinutes (wholenumber_t m)
 
bool adjustTimeZone (int64_t o)
 
void formatBaseDate (char *buffer, size_t size)
 
void formatBaseTime (char *buffer)
 
void formatUnixTime (char *buffer)
 
void formatDays (char *buffer, size_t size)
 
void formatEuropeanDate (char *buffer, size_t size, const char *sep)
 
void formatMonthName (char *buffer)
 
void formatNormalDate (char *buffer, size_t size, const char *sep)
 
void formatOrderedDate (char *buffer, size_t size, const char *sep)
 
void formatStandardDate (char *buffer, size_t size, const char *sep)
 
void formatUsaDate (char *buffer, size_t size, const char *sep)
 
void formatWeekDay (char *buffer)
 
void formatCivilTime (char *buffer, size_t size)
 
void formatHours (char *buffer, size_t size)
 
void formatLongTime (char *buffer, size_t size)
 
void formatMinutes (char *buffer, size_t size)
 
void formatNormalTime (char *buffer, size_t size)
 
void formatSeconds (char *buffer, size_t size)
 
void formatTimeZone (char *buffer)
 
void setTimeZoneOffset (int64_t o)
 
int64_t getTimeZoneOffset ()
 

Public Attributes

bool valid
 
int year
 
int month
 
int day
 
int hours
 
int minutes
 
int seconds
 
int microseconds
 
int64_t timeZoneOffset
 

Protected Member Functions

bool parseDateTimeFormat (const char *date, const char *format, const char *sep, wholenumber_t currentYear)
 
bool getNumber (const char *input, wholenumber_t length, int *target)
 
bool getNumber (const char *input, wholenumber_t length, int *target, int max)
 

Static Protected Attributes

static const char * dayNames []
 
static const char * monthNames []
 
static int monthStarts []
 
static int leapMonthStarts []
 
static int monthdays []
 
static RexxDateTime unixBaseTime
 
static RexxDateTime maxBaseTime
 

Detailed Description

Definition at line 110 of file RexxDateTime.hpp.

Constructor & Destructor Documentation

◆ RexxDateTime() [1/5]

RexxDateTime::RexxDateTime ( )

Default constructor for a RexxDateTime instance. This initializes the time to all zeros.

Definition at line 101 of file RexxDateTime.cpp.

References clear().

◆ RexxDateTime() [2/5]

RexxDateTime::RexxDateTime ( int64_t  basetime)

Create a RexxDateTime instance from a basetime value.

Parameters
basetimeThe basetime for this instance.

Definition at line 112 of file RexxDateTime.cpp.

References clear(), and setBaseTime().

◆ RexxDateTime() [3/5]

RexxDateTime::RexxDateTime ( wholenumber_t  basedate,
bool  dummy 
)

Create a RexxDateTime instance from a baseDate value.

Parameters
basedate
dummyDummy argument to allow constructor overload to work.

Definition at line 127 of file RexxDateTime.cpp.

References clear(), and setBaseDate().

◆ RexxDateTime() [4/5]

RexxDateTime::RexxDateTime ( wholenumber_t  y,
wholenumber_t  m,
wholenumber_t  d 
)

Create a RexxDateTime instance from a year/month/day value.

Parameters
yThe current year.
mThe month.
dThe day.

Definition at line 141 of file RexxDateTime.cpp.

References clear(), day, month, and year.

◆ RexxDateTime() [5/5]

RexxDateTime::RexxDateTime ( wholenumber_t  y,
wholenumber_t  m,
wholenumber_t  d,
wholenumber_t  h,
wholenumber_t  i,
wholenumber_t  s,
wholenumber_t  u 
)

Create a RexxDateTime instance from a fully resolved date time value.

Parameters
yThe date year.
mThe date month.
dThe date day.
hThe time hour.
iThe time minues
sThe time secons.
uThe time microseconds.

Definition at line 162 of file RexxDateTime.cpp.

References day, hours, microseconds, minutes, month, seconds, valid, and year.

Member Function Documentation

◆ adjustTimeZone()

bool RexxDateTime::adjustTimeZone ( int64_t  o)

Adjust the timestamp to a new timezone offset.

Parameters
oThe offset value (in microseconds)
Returns
true if the time was set properly. false if the value was invalid.

Definition at line 734 of file RexxDateTime.cpp.

References getUTCBaseTime(), setBaseTime(), and timeZoneOffset.

Referenced by BUILTIN().

◆ clear()

void RexxDateTime::clear ( )

Clear all of the values within a time object. This will reset the time to an invalid time value.

Definition at line 420 of file RexxDateTime.cpp.

References day, hours, microseconds, minutes, month, seconds, valid, and year.

Referenced by BUILTIN(), RexxDateTime(), setBaseDate(), and setTimeInSeconds().

◆ formatBaseDate()

void RexxDateTime::formatBaseDate ( char *  buffer,
size_t  size 
)

Format a base date into human readable form.

Parameters
bufferThe target buffer for the output.

Definition at line 1139 of file RexxDateTime.cpp.

References getBaseDate().

Referenced by BUILTIN().

◆ formatBaseTime()

void RexxDateTime::formatBaseTime ( char *  buffer)

Format a base time into human readable form.

Parameters
bufferThe target buffer for the output.

Definition at line 1151 of file RexxDateTime.cpp.

References Numerics::formatInt64(), and getBaseTime().

Referenced by BUILTIN().

◆ formatCivilTime()

void RexxDateTime::formatCivilTime ( char *  buffer,
size_t  size 
)

Format a time in 'C'ivil format.

Parameters
bufferThe target buffer for the output.

Definition at line 1290 of file RexxDateTime.cpp.

References ANTEMERIDIAN, hours, minutes, and POSTMERIDIAN.

Referenced by BUILTIN().

◆ formatDays()

void RexxDateTime::formatDays ( char *  buffer,
size_t  size 
)

Format a date as the number of days in the current year.

Parameters
bufferThe target buffer for the output.

Definition at line 1173 of file RexxDateTime.cpp.

References getYearDay().

Referenced by BUILTIN().

◆ formatEuropeanDate()

void RexxDateTime::formatEuropeanDate ( char *  buffer,
size_t  size,
const char *  sep 
)

Format a date in 'E'uropean format.

Parameters
bufferThe target buffer for the output.
sepThe separator character used for the fields. This value can be NULL, in which case the default is used. The string value can also be a null string ("").

Definition at line 1188 of file RexxDateTime.cpp.

References day, month, and year.

Referenced by BUILTIN().

◆ formatHours()

void RexxDateTime::formatHours ( char *  buffer,
size_t  size 
)

Format a time in 'H'ours format.

Parameters
bufferThe target buffer for the output.

Definition at line 1310 of file RexxDateTime.cpp.

References hours.

Referenced by BUILTIN().

◆ formatLongTime()

void RexxDateTime::formatLongTime ( char *  buffer,
size_t  size 
)

Format a time in 'L'ong format.

Parameters
bufferThe target buffer for the output.

Definition at line 1321 of file RexxDateTime.cpp.

References hours, microseconds, minutes, and seconds.

Referenced by BUILTIN().

◆ formatMinutes()

void RexxDateTime::formatMinutes ( char *  buffer,
size_t  size 
)

Format a time in 'M'inutes format.

Parameters
bufferThe target buffer for the output.

Definition at line 1332 of file RexxDateTime.cpp.

References hours, minutes, and MINUTES_IN_HOUR.

Referenced by BUILTIN().

◆ formatMonthName()

void RexxDateTime::formatMonthName ( char *  buffer)

Format a date as the name of the current month.

Parameters
bufferThe target buffer for the output.

Definition at line 1201 of file RexxDateTime.cpp.

References getMonthName().

Referenced by BUILTIN().

◆ formatNormalDate()

void RexxDateTime::formatNormalDate ( char *  buffer,
size_t  size,
const char *  sep 
)

Format a date in 'N'ormal format.

Parameters
bufferThe target buffer for the output.
sepThe separator character used for the fields. This value can be NULL, in which case the default is used. The string value can also be a null string ("").

Definition at line 1215 of file RexxDateTime.cpp.

References day, month, monthNames, and year.

Referenced by BUILTIN().

◆ formatNormalTime()

void RexxDateTime::formatNormalTime ( char *  buffer,
size_t  size 
)

Format a time in 'N'ormal format.

Parameters
bufferThe target buffer for the output.

Definition at line 1343 of file RexxDateTime.cpp.

References hours, minutes, and seconds.

Referenced by BUILTIN().

◆ formatOrderedDate()

void RexxDateTime::formatOrderedDate ( char *  buffer,
size_t  size,
const char *  sep 
)

Format a date in 'O'rdered format.

Parameters
bufferThe target buffer for the output.
sepThe separator character used for the fields. This value can be NULL, in which case the default is used. The string value can also be a null string ("").

Definition at line 1231 of file RexxDateTime.cpp.

References day, month, and year.

Referenced by BUILTIN().

◆ formatSeconds()

void RexxDateTime::formatSeconds ( char *  buffer,
size_t  size 
)

Format a time in 'S'econds format.

Parameters
bufferThe target buffer for the output.

Definition at line 1354 of file RexxDateTime.cpp.

References hours, minutes, MINUTES_IN_HOUR, seconds, and SECONDS_IN_MINUTE.

Referenced by BUILTIN().

◆ formatStandardDate()

void RexxDateTime::formatStandardDate ( char *  buffer,
size_t  size,
const char *  sep 
)

Format a date in 'S'tandard format.

Parameters
bufferThe target buffer for the output.
sepThe separator character used for the fields. This value can be NULL, in which case the default is used. The string value can also be a null string ("").

Definition at line 1247 of file RexxDateTime.cpp.

References day, month, and year.

Referenced by BUILTIN().

◆ formatTimeZone()

void RexxDateTime::formatTimeZone ( char *  buffer)

Format a the time zone offset value

Parameters
bufferThe target buffer for the output.

Definition at line 1365 of file RexxDateTime.cpp.

References Numerics::formatInt64(), and timeZoneOffset.

Referenced by BUILTIN().

◆ formatUnixTime()

void RexxDateTime::formatUnixTime ( char *  buffer)

Format a unix time into human readable form.

Parameters
bufferThe target buffer for the output.

Definition at line 1162 of file RexxDateTime.cpp.

References Numerics::formatInt64(), and getUnixTime().

Referenced by BUILTIN().

◆ formatUsaDate()

void RexxDateTime::formatUsaDate ( char *  buffer,
size_t  size,
const char *  sep 
)

Format a date in 'U'sa format.

Parameters
bufferThe target buffer for the output.
sepThe separator character used for the fields. This value can be NULL, in which case the default is used. The string value can also be a null string ("").

Definition at line 1263 of file RexxDateTime.cpp.

References day, month, and year.

Referenced by BUILTIN().

◆ formatWeekDay()

void RexxDateTime::formatWeekDay ( char *  buffer)

Format a date as the name of the current day.

Parameters
bufferThe target buffer for the output.

Definition at line 1278 of file RexxDateTime.cpp.

References getDayName().

Referenced by BUILTIN().

◆ getBaseDate()

wholenumber_t RexxDateTime::getBaseDate ( )

Retrieve the basedate from the timestamp. The basedate is the number of days since 01 Jan 0001, calculated using a Gregorian calendar system for the entire date range.

Returns
The integer value for the basedate, in days.

Definition at line 182 of file RexxDateTime.cpp.

References getYearDay(), and year.

Referenced by formatBaseDate(), getBaseTime(), getWeekDay(), and setBaseDate().

◆ getBaseTime()

int64_t RexxDateTime::getBaseTime ( )

Calculate the basetime, returned as the number of microseconds since 00:00:00.000000 on 01 Jan 0001. The basetime is calculated using the same Gregorian calendar system used to calculate the basedate.

Returns
The basetime as a 64-bit integer value.

Definition at line 213 of file RexxDateTime.cpp.

References getBaseDate(), getTimeSeconds(), MICROSECONDS, microseconds, and SECONDS_IN_DAY.

Referenced by formatBaseTime(), RexxActivity::generateRandomNumberSeed(), getUnixTime(), getUTCBaseTime(), setBaseTime(), and setUnixTime().

◆ getDayName()

const char * RexxDateTime::getDayName ( )

Return the current day of the week, as a name.

Returns
The string name of the timestamp day.

Definition at line 510 of file RexxDateTime.cpp.

References dayNames, and getWeekDay().

Referenced by formatWeekDay().

◆ getMonthName()

const char * RexxDateTime::getMonthName ( )

Get the name of the timestamp month, as a string.

Returns
The string name of the timestamp month.

Definition at line 521 of file RexxDateTime.cpp.

References month, and monthNames.

Referenced by formatMonthName().

◆ getNumber() [1/2]

bool RexxDateTime::getNumber ( const char *  input,
wholenumber_t  length,
int *  target 
)
protected

Internal routine used to extract short number fields from a date/time format.

Parameters
inputThe current input position.
lengthThe length of the field.
targetThe returned integer value.
Returns
true if the field is valid, false for any parsing error.

Definition at line 1082 of file RexxDateTime.cpp.

Referenced by getNumber(), and parseDateTimeFormat().

◆ getNumber() [2/2]

bool RexxDateTime::getNumber ( const char *  input,
wholenumber_t  length,
int *  target,
int  max 
)
protected

Internal method for parsing short numeric fields from a date/time value.

Parameters
inputThe current input position.
lengthThe length of the field.
targetThe returned value.
maxThe max value range for the parsed number.
Returns
true if the number is valid, false for any parsing/validation errors.

Definition at line 1119 of file RexxDateTime.cpp.

References getNumber().

◆ getTimeSeconds()

wholenumber_t RexxDateTime::getTimeSeconds ( )

Get the time in seconds from midnight in the current timestamp day.

Returns
The calculated integer time, in seconds.

Definition at line 199 of file RexxDateTime.cpp.

References hours, minutes, MINUTES_IN_HOUR, seconds, and SECONDS_IN_MINUTE.

Referenced by getBaseTime().

◆ getTimeZoneOffset()

int64_t RexxDateTime::getTimeZoneOffset ( )
inline

Definition at line 171 of file RexxDateTime.hpp.

References timeZoneOffset.

Referenced by BUILTIN().

◆ getUnixTime()

int64_t RexxDateTime::getUnixTime ( )

Calculate the basetime, returned as the number of seconds since 00:00:00.000000 on 01 Jan 1970. The basetime is calculated using the same Gregorian calendar system used to calculate the basedate. Times prior to 01 Jan 1970 are returned as a negative number.

Returns
The unix time as a 64-bit integer value.

Definition at line 248 of file RexxDateTime.cpp.

References getBaseTime(), MICROSECONDS, and unixBaseTime.

Referenced by formatUnixTime().

◆ getUTCBaseTime()

int64_t RexxDateTime::getUTCBaseTime ( )

Return this time as a UTC timestamp (adjusted for the timezone offset);

Returns

Definition at line 233 of file RexxDateTime.cpp.

References getBaseTime(), and timeZoneOffset.

Referenced by adjustTimeZone(), BUILTIN(), RexxActivation::getElapsed(), and RexxActivation::getTime().

◆ getWeekDay()

wholenumber_t RexxDateTime::getWeekDay ( )

Return the day in the week as an integer value. Sundy is 0, Monday is 1, etc.

Returns
The integer offset for the day of the week.

Definition at line 499 of file RexxDateTime.cpp.

References getBaseDate().

Referenced by getDayName().

◆ getYearDay()

wholenumber_t RexxDateTime::getYearDay ( )

Return the number of days since the start of the year.

Returns
The count of days since the beginning of the contained year.

Definition at line 480 of file RexxDateTime.cpp.

References day, isLeapYear(), month, and monthStarts.

Referenced by formatDays(), and getBaseDate().

◆ isLeapYear()

bool RexxDateTime::isLeapYear ( )
inline

Definition at line 120 of file RexxDateTime.hpp.

References CENTURY, LEAP_CYCLE, OLYMPIAD, and year.

Referenced by getYearDay(), and parseDateTimeFormat().

◆ parseCivilTime()

bool RexxDateTime::parseCivilTime ( const char *  time)

Parse a time in 'C'ivil format into the timestamp.

Parameters
dateThe string version of the date.
Returns
true if the date parses correctly, false for any parsing errors.

Definition at line 632 of file RexxDateTime.cpp.

References parseDateTimeFormat().

Referenced by BUILTIN().

◆ parseDateTimeFormat()

bool RexxDateTime::parseDateTimeFormat ( const char *  date,
const char *  format,
const char *  sep,
wholenumber_t  currentYear 
)
protected

Parse an input date or time vs. a format template that describes the various fields.

Format specifiers are:

      '/'   A sepaarator is expected (passed in)
      'm'   Start of a month specification
      'd'   Start of a day specification
      'y'   Start of a 2-digit year spec
      'Y'   Start of a 4-digit year spec
      'M'   Start of a "named" 3 character month
      'h'   Start of a 12-hour hour field
      'H'   Start of a 24-hour hour field
      'i'   Start of a mInutes field
      's'   Start of a seconds field
      'u'   Start of a microseconds field
      'C'   Start of a Civil time meridian designation
      'c'   Start of a Civil time hour (no leading blanks)
      ':'   ':' expected at this position
      '.'   '.' expected at this position
Parameters
dateThe input date (or time).
formatThe format the date/time is expected to be in.
sepA variable separator character expected to be found in the input. Separators are marked with "/" in the format template. The separator can be a null string "".
currentYearThe current year value (used for formats that don't include century information).
Returns
true if the date parses correctly, false otherwise.

Definition at line 778 of file RexxDateTime.cpp.

References ANTEMERIDIAN, CENTURY, CHAR_MONTH, day, DAY_SIZE, FEBRUARY, FUTURE_THRESHOLD, getNumber(), hours, HOURS_SIZE, isLeapYear(), LEAPMONTH, LONG_YEAR, MAXCIVILHOURS, MAXHOURS, MAXMINUTES, MAXSECONDS, MICRO_SIZE, microseconds, minutes, MINUTES_SIZE, month, MONTH_SIZE, monthdays, monthNames, MONTHS, PAST_THRESHOLD, POSTMERIDIAN, seconds, SECONDS_SIZE, SHORT_YEAR, and year.

Referenced by parseCivilTime(), parseEuropeanDate(), parseLongTime(), parseNormalDate(), parseNormalTime(), parseOrderedDate(), parseStandardDate(), and parseUsaDate().

◆ parseEuropeanDate()

bool RexxDateTime::parseEuropeanDate ( const char *  date,
const char *  sep,
wholenumber_t  currentYear 
)

Parse a date in 'E'uropean format into the timestamp.

Parameters
dateThe string version of the date.
sepThe field separator character used in the date. This argument can be NULL, which means use the default separator.
currentYearThe current year used to fill in the centuries portion of the date.
Returns
true if the date parses correctly, false for any parsing errors.

Definition at line 570 of file RexxDateTime.cpp.

References parseDateTimeFormat().

Referenced by BUILTIN().

◆ parseLongTime()

bool RexxDateTime::parseLongTime ( const char *  time)

Parse a time in 'L'ong format into the timestamp.

Parameters
dateThe string version of the date.
Returns
true if the date parses correctly, false for any parsing errors.

Definition at line 645 of file RexxDateTime.cpp.

References parseDateTimeFormat().

Referenced by BUILTIN().

◆ parseNormalDate()

bool RexxDateTime::parseNormalDate ( const char *  date,
const char *  sep 
)

Parse a date in 'N'ormal format into the timestamp.

Parameters
dateThe string version of the date.
sepThe field separator character used in the date. This argument can be NULL, which means use the default separator.
Returns
true if the date parses correctly, false for any parsing errors.

Definition at line 536 of file RexxDateTime.cpp.

References parseDateTimeFormat().

Referenced by BUILTIN().

◆ parseNormalTime()

bool RexxDateTime::parseNormalTime ( const char *  time)

Parse a time in 'N'ormal format into the timestamp.

Parameters
dateThe string version of the date.
Returns
true if the date parses correctly, false for any parsing errors.

Definition at line 619 of file RexxDateTime.cpp.

References parseDateTimeFormat().

Referenced by BUILTIN().

◆ parseOrderedDate()

bool RexxDateTime::parseOrderedDate ( const char *  date,
const char *  sep,
wholenumber_t  currentYear 
)

Parse a date in 'O'rderd format into the timestamp.

Parameters
dateThe string version of the date.
sepThe field separator character used in the date. This argument can be NULL, which means use the default separator.
currentYearThe current year used to fill in the centuries portion of the date.
Returns
true if the date parses correctly, false for any parsing errors.

Definition at line 606 of file RexxDateTime.cpp.

References parseDateTimeFormat().

Referenced by BUILTIN().

◆ parseStandardDate()

bool RexxDateTime::parseStandardDate ( const char *  date,
const char *  sep 
)

Parse a date in 'S'tandard format into the timestamp.

Parameters
dateThe string version of the date.
sepThe field separator character used in the date. This argument can be NULL, which means use the default separator.
Returns
true if the date parses correctly, false for any parsing errors.

Definition at line 552 of file RexxDateTime.cpp.

References parseDateTimeFormat().

Referenced by BUILTIN().

◆ parseUsaDate()

bool RexxDateTime::parseUsaDate ( const char *  date,
const char *  sep,
wholenumber_t  currentYear 
)

Parse a date in 'U'sa format into the timestamp.

Parameters
dateThe string version of the date.
sepThe field separator character used in the date. This argument can be NULL, which means use the default separator.
currentYearThe current year used to fill in the centuries portion of the date.
Returns
true if the date parses correctly, false for any parsing errors.

Definition at line 588 of file RexxDateTime.cpp.

References parseDateTimeFormat().

Referenced by BUILTIN().

◆ setBaseDate()

bool RexxDateTime::setBaseDate ( wholenumber_t  base)

Set the date from a basedate value. The basedate is the number of days since 01 Jan 0001.

Parameters
basedaysThe basedays value (must be a positive integer).

Definition at line 261 of file RexxDateTime.cpp.

References BASE_DAYS, CENTURY, CENTURY_DAYS, clear(), day, getBaseDate(), LEAP_CYCLE, LEAP_DAYS, leapMonthStarts, LeapYear, maxBaseTime, month, monthStarts, OLYMPIAD, OLYMPIAD_DAYS, year, and YEAR_DAYS.

Referenced by BUILTIN(), RexxDateTime(), and setBaseTime().

◆ setBaseTime()

bool RexxDateTime::setBaseTime ( int64_t  basetime)

Set the date and time from a basetime value. The basetime is the number of microseconds from 00:00:00 on 01 Jan 0001.

Parameters
basetimeThe input timestamp, in microseconds.

Definition at line 355 of file RexxDateTime.cpp.

References getBaseTime(), hours, maxBaseTime, MICROSECONDS, microseconds, MICROSECONDS_IN_DAY, minutes, seconds, SECONDS_IN_HOUR, SECONDS_IN_MINUTE, and setBaseDate().

Referenced by adjustTimeZone(), BUILTIN(), RexxDateTime(), and setUnixTime().

◆ setDate()

void RexxDateTime::setDate ( wholenumber_t  newYear,
wholenumber_t  newDay 
)

Set the date value using a year/day in year pair.

Parameters
newYearThe year to set.
newDayThe day within the year to set.

Definition at line 438 of file RexxDateTime.cpp.

References setDay(), and year.

Referenced by BUILTIN().

◆ setDay()

void RexxDateTime::setDay ( wholenumber_t  basedays)

Set the day in the year from a day offset. The year must be valid in the timestamp for this to work properly, as it is necessary to know if the current year is a leap year to properly calculate the month and day.

Parameters
basedaysThe days from the start of the year.

Definition at line 454 of file RexxDateTime.cpp.

References day, leapMonthStarts, LeapYear, month, monthStarts, and year.

Referenced by setDate().

◆ setHours()

bool RexxDateTime::setHours ( wholenumber_t  h)

Set the time from an hours value. This sets all other time elements to zero.

Parameters
hThe hours value.
Returns
true if the time was set properly. false if the hours value was invalid.

Definition at line 660 of file RexxDateTime.cpp.

References hours, HOURS_IN_DAY, microseconds, minutes, and seconds.

Referenced by BUILTIN().

◆ setMinutes()

bool RexxDateTime::setMinutes ( wholenumber_t  m)

Set the time from a minutes value. This sets the hour and minute values. The seconds and microseconds field are set to zero.

Parameters
mThe minutes value.
Returns
true if the time was set properly. false if the value was invalid.

Definition at line 710 of file RexxDateTime.cpp.

References hours, microseconds, minutes, MINUTES_IN_DAY, MINUTES_IN_HOUR, and seconds.

Referenced by BUILTIN().

◆ setSeconds()

bool RexxDateTime::setSeconds ( wholenumber_t  s)

Set the time from a seconds value. This sets the hour and minute values. The microseconds field is set to zero.

Parameters
sThe seconds value.
Returns
true if the time was set properly. false if the value was invalid.

Definition at line 683 of file RexxDateTime.cpp.

References hours, microseconds, minutes, seconds, SECONDS_IN_DAY, SECONDS_IN_HOUR, and SECONDS_IN_MINUTE.

Referenced by BUILTIN().

◆ setTimeInSeconds()

void RexxDateTime::setTimeInSeconds ( wholenumber_t  basetime)

Set the time stamp using the number of seconds since midnight.

Parameters
basetimeThe basetime, in seconds.

Definition at line 405 of file RexxDateTime.cpp.

References clear(), hours, minutes, seconds, SECONDS_IN_HOUR, and SECONDS_IN_MINUTE.

◆ setTimeZoneOffset()

void RexxDateTime::setTimeZoneOffset ( int64_t  o)
inline

Definition at line 170 of file RexxDateTime.hpp.

References timeZoneOffset.

Referenced by BUILTIN().

◆ setUnixTime()

bool RexxDateTime::setUnixTime ( int64_t  basetime)

Set the date and time from a unix time value. The unix time is the number of seconds from 00:00:00 on 01 Jan 1970. The value may be either positive or negative.

Parameters
basetimeThe input timestamp, in seconds.

Definition at line 391 of file RexxDateTime.cpp.

References getBaseTime(), MICROSECONDS, setBaseTime(), and unixBaseTime.

Referenced by BUILTIN().

Member Data Documentation

◆ day

◆ dayNames

const char * RexxDateTime::dayNames
staticprotected
Initial value:
=
{
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
}

Definition at line 189 of file RexxDateTime.hpp.

Referenced by getDayName().

◆ hours

◆ leapMonthStarts

int RexxDateTime::leapMonthStarts
staticprotected
Initial value:
=
{
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
}

Definition at line 192 of file RexxDateTime.hpp.

Referenced by setBaseDate(), and setDay().

◆ maxBaseTime

RexxDateTime RexxDateTime::maxBaseTime
staticprotected

Definition at line 195 of file RexxDateTime.hpp.

Referenced by setBaseDate(), and setBaseTime().

◆ microseconds

◆ minutes

◆ month

◆ monthdays

int RexxDateTime::monthdays
staticprotected
Initial value:
=
{
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
}

Definition at line 193 of file RexxDateTime.hpp.

Referenced by parseDateTimeFormat().

◆ monthNames

const char * RexxDateTime::monthNames
staticprotected
Initial value:
=
{
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
}

Definition at line 190 of file RexxDateTime.hpp.

Referenced by formatNormalDate(), getMonthName(), and parseDateTimeFormat().

◆ monthStarts

int RexxDateTime::monthStarts
staticprotected
Initial value:
=
{
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
}

Definition at line 191 of file RexxDateTime.hpp.

Referenced by getYearDay(), setBaseDate(), and setDay().

◆ seconds

◆ timeZoneOffset

◆ unixBaseTime

RexxDateTime RexxDateTime::unixBaseTime
staticprotected

Definition at line 194 of file RexxDateTime.hpp.

Referenced by getUnixTime(), and setUnixTime().

◆ valid

bool RexxDateTime::valid

◆ year


The documentation for this class was generated from the following files: