feisty meow concerns codebase  2.140
timely::day_in_year Class Reference

An object that represents a particular day in a year. More...

#include <earth_time.h>

Inheritance diagram for timely::day_in_year:
Collaboration diagram for timely::day_in_year:

Public Types

enum  date_formats { SHORT_MONTH = 0x1 , LONG_MONTH = 0x2 , INCLUDE_DAY = 0x4 }
 An enumeration of ways to print out the current date. More...
 

Public Member Functions

int packed_size () const
 Estimates the space needed for the packed structure. More...
 
 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. More...
 
virtual void pack (basis::byte_array &packed_form) const
 Packs a day object into an array of bytes. More...
 
virtual bool unpack (basis::byte_array &packed_form)
 Unpacks a day object from an array of bytes. More...
 
bool operator< (const day_in_year &to_compare) const
 Returns true if this day is earlier than "to_compare". More...
 
bool operator== (const day_in_year &to_compare) const
 Returns true if this day is equal to "to_compare". More...
 
basis::astring text_form (int how=SHORT_MONTH) const
 Prints the day according to "how". More...
 
void text_form (basis::astring &to_stuff, int how=SHORT_MONTH) const
 Prints the day according to "how" and stores it in "to_stuff". More...
 

Static Public Member Functions

static time_number normalize (day_in_year &to_fix, bool leap_year=false)
 normalizes the day as needed and returns the adjustment in years. More...
 

Public Attributes

months month
 The current month. More...
 
time_number day_in_month
 The day number within the month (starting at one). More...
 
days day_of_week
 The day of the week. More...
 
time_number day_of_year
 Numerical day, where January 1st is equal to zero. More...
 

Detailed Description

An object that represents a particular day in a year.

Definition at line 138 of file earth_time.h.

Member Enumeration Documentation

◆ date_formats

An enumeration of ways to print out the current date.

Enumerator
SHORT_MONTH 

default: three letter month.

LONG_MONTH 

uses full month name.

INCLUDE_DAY 

adds the name of the day.

Definition at line 166 of file earth_time.h.

Constructor & Destructor Documentation

◆ day_in_year()

timely::day_in_year::day_in_year ( months  m = JANUARY,
time_number  dim = 1,
days  dow = SUNDAY,
time_number  day_o_year = 1 
)
inline

Constructs a representation of the day specified.

Definition at line 149 of file earth_time.h.

Member Function Documentation

◆ normalize()

time_number timely::day_in_year::normalize ( day_in_year to_fix,
bool  leap_year = false 
)
static

normalizes the day as needed and returns the adjustment in years.

note that this only adjusts the day_in_month and month members currently. the other counters are not changed.

Definition at line 229 of file earth_time.cpp.

References day_in_month, timely::days_in_month, timely::leap_days_in_month, timely::limit_day_of_month(), limit_value, and month.

◆ operator<()

bool timely::day_in_year::operator< ( const day_in_year to_compare) const

Returns true if this day is earlier than "to_compare".

Note that this only compares the month and day in the month.

Definition at line 184 of file earth_time.cpp.

References day_in_month, EASY_LT, and month.

◆ operator==()

bool timely::day_in_year::operator== ( const day_in_year to_compare) const

Returns true if this day is equal to "to_compare".

Note that this only compares the month and day in the month.

Definition at line 191 of file earth_time.cpp.

References day_in_month, and month.

◆ pack()

void timely::day_in_year::pack ( basis::byte_array packed_form) const
virtual

Packs a day object into an array of bytes.

Implements basis::packable.

Reimplemented in timely::time_locus.

Definition at line 161 of file earth_time.cpp.

References basis::attach().

◆ packed_size()

int timely::day_in_year::packed_size ( ) const
inlinevirtual

Estimates the space needed for the packed structure.

Implements basis::packable.

Reimplemented in timely::time_locus.

Definition at line 146 of file earth_time.h.

References structures::PACKED_SIZE_INT64.

Referenced by timely::time_locus::packed_size().

◆ text_form() [1/2]

void timely::day_in_year::text_form ( basis::astring to_stuff,
int  how = SHORT_MONTH 
) const

Prints the day according to "how" and stores it in "to_stuff".

Definition at line 204 of file earth_time.cpp.

References timely::day_name(), timely::month_name(), and timely::short_month_name().

◆ text_form() [2/2]

astring timely::day_in_year::text_form ( int  how = SHORT_MONTH) const

Prints the day according to "how".

Definition at line 197 of file earth_time.cpp.

◆ unpack()

bool timely::day_in_year::unpack ( basis::byte_array packed_form)
virtual

Unpacks a day object from an array of bytes.

Implements basis::packable.

Reimplemented in timely::time_locus.

Definition at line 171 of file earth_time.cpp.

References basis::detach().

Member Data Documentation

◆ day_in_month

time_number timely::day_in_year::day_in_month

The day number within the month (starting at one).

Definition at line 142 of file earth_time.h.

Referenced by timely::convert(), normalize(), timely::time_locus::normalize(), operator<(), and operator==().

◆ day_of_week

days timely::day_in_year::day_of_week

The day of the week.

Definition at line 143 of file earth_time.h.

Referenced by timely::convert(), timely::day_now(), and timely::time_control::set_time().

◆ day_of_year

time_number timely::day_in_year::day_of_year

Numerical day, where January 1st is equal to zero.

Definition at line 144 of file earth_time.h.

Referenced by timely::convert(), and timely::time_control::set_time().

◆ month

months timely::day_in_year::month

The current month.

Definition at line 141 of file earth_time.h.

Referenced by timely::convert(), timely::month_now(), normalize(), operator<(), operator==(), and timely::time_control::set_time().


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