1 #ifndef EARTH_TIME_GROUP
2 #define EARTH_TIME_GROUP
Provides a dynamically resizable ASCII character string.
Defines the base class for all string processing objects in hoople.
virtual base_string & assign(const base_string &s)=0
Sets the contents of this string to "s".
A very common template for a dynamic array of bytes.
Base class for object that can tell itself apart from other instances.
the base class of the most easily used and tested objects in the library.
A base for objects that can be alphabetically (lexicographically) ordered.
A base class for objects that can pack into an array of bytes.
A specific point in time as represented by a 24 hour clock.
bool operator<(const clock_time &to_compare) const
Returns true if this clock_time is earlier than "to_compare".
clock_time(time_number h=0, time_number m=0, time_number s=0, time_number ms=0, time_number us=0)
Constructs a clock_time object given all the parts.
time_number minute
The number of minutes after the hour.
basis::astring text_form(int how=MERIDIAN) const
Prints the clock_time according to "how".
static time_number normalize(clock_time &to_fix)
time_formats
An enumeration of time formatting modes used when printing the time.
@ NO_AM_PM
use 12 hour time but don't include AM/PM.
@ MERIDIAN
default: uses 12 hour with AM/PM and no seconds.
@ MILITARY
use military 24 hour time.
@ MILLISECONDS
milliseconds are fourth field (after secs).
@ SECONDS
include the number of seconds as a third field.
virtual bool unpack(basis::byte_array &packed_form)
Unpacks a clock time from an array of bytes.
virtual void pack(basis::byte_array &packed_form) const
Packs a clock time into an array of bytes.
bool operator==(const clock_time &to_compare) const
Returns true if this clock_time is equal to "to_compare".
time_number second
The number of seconds after the current minute.
time_number microsecond
Number of microseconds elapsed in this millisecond.
time_number hour
The hour represented in military time: 0 through 23.
time_number millisecond
The number of milliseconds elapsed in this second.
int packed_size() const
Estimates the space needed for the packed structure.
An object that represents a particular day in a year.
bool operator==(const day_in_year &to_compare) const
Returns true if this day is equal to "to_compare".
time_number day_of_year
Numerical day, where January 1st is equal to zero.
date_formats
An enumeration of ways to print out the current date.
@ LONG_MONTH
uses full month name.
@ INCLUDE_DAY
adds the name of the day.
@ SHORT_MONTH
default: three letter month.
time_number day_in_month
The day number within the month (starting at one).
basis::astring text_form(int how=SHORT_MONTH) const
Prints the day according to "how".
days day_of_week
The day of the week.
virtual void pack(basis::byte_array &packed_form) const
Packs a day object into an array of bytes.
static time_number normalize(day_in_year &to_fix, bool leap_year=false)
normalizes the day as needed and returns the adjustment in years.
months month
The current month.
day_in_year(months m=JANUARY, time_number dim=1, days dow=SUNDAY, time_number day_o_year=1)
Constructs a representation of the day specified.
virtual bool unpack(basis::byte_array &packed_form)
Unpacks a day object from an array of bytes.
int packed_size() const
Estimates the space needed for the packed structure.
bool operator<(const day_in_year &to_compare) const
Returns true if this day is earlier than "to_compare".
An object that represents a particular point in time.
virtual bool less_than(const basis::orderable &s2) const
static time_number normalize(time_locus &to_fix)
Same as text_form() above, but stores into "to_stuff".
locus_formats
< Returns true if this time_locus is earlier than "to_compare"
@ SHORT_YEAR
use only last two digits of year. ugh–Y2K danger.
@ LONG_YEAR
default: full four digit year (problems in 9999).
virtual void pack(basis::byte_array &packed_form) const
Packs a time_locus object into an array of bytes.
basis::astring text_form_long(int t=clock_time::MERIDIAN, int d=day_in_year::SHORT_MONTH, int y=LONG_YEAR) const
time_number year
The year, using the gregorian calendar.
int packed_size() const
Estimates the space needed for the packed structure.
time_locus(const clock_time &ct, const day_in_year &ytd, time_number year_in)
Constructs a location in time given its components.
virtual void text_form(basis::base_string &state_fill) const
Provides a text view of all the important info owned by this object.
virtual bool equal_to(const basis::equalizable &s2) const
virtual bool unpack(basis::byte_array &packed_form)
Unpacks a time_locus object from an array of bytes.
DEFINE_CLASS_NAME("time_locus")
long int signed_long
Abbreviated name for signed long integers.
const int PACKED_SIZE_INT64
const int PACKED_SIZE_INT32
const char * month_name(months to_name)
Returns the name of the month "to_name".
time_zones
An enumeration of time zones, both relative and absolute.
@ GREENWICH_ZONE
The time zone of Greenwich Mean Time.
@ LOCAL_ZONE
The time zone this computer is configured to report.
basis::signed_long time_number
time_locus greenwich_now()
returns Greenwich Mean Time (their now).
time_locus now()
returns our current locus in the time continuum.
const char * day_name(days to_name)
Returns the name of the day "to_name".
const time_number DAYS_IN_YEAR
Number of days in a standard year.
const time_number MINUTES_IN_HOUR
Number of minutes in an hour.
const time_number SECONDS_IN_DAY
Number of seconds in a day.
time_number year_now()
what year is it?
const double APPROX_DAYS_IN_YEAR
A more accurate measure of the number of days in a year.
const time_number SECONDS_IN_HOUR
Number of seconds in an hour.
const time_number leap_days_in_month[12]
The number of days in each month in a leap year.
const time_number julian_days_in_month[12]
Number of days in each month based on the julian calendar.
clock_time time_now()
what time is it?
days day_now()
Returns the current local day.
const time_number HOURS_IN_DAY
Number of hours in a day.
const char * short_month_name(months to_name)
Returns a shorter, constant-length (3 characters) month name.
const time_number SECONDS_IN_MINUTE
Number of seconds in one minute.
const time_number MINUTES_IN_DAY
Number of minutes in a day.
const time_number LEAP_DAYS_IN_YEAR
Number of days in a leap year.
day_in_year date_now()
what day on the calendar is it?
const time_number julian_leap_days_in_month[12]
Number of days in each month of a leap year in the julian calendar.
const time_number days_in_month[12]
The number of days in each month in the standard year.
months month_now()
returns the local month.