feisty meow concerns codebase  2.140
timely::time_locus Class Reference

An object that represents a particular point in time. More...

#include <earth_time.h>

Inheritance diagram for timely::time_locus:
Collaboration diagram for timely::time_locus:

Public Types

enum  locus_formats { LONG_YEAR = 0x1 , SHORT_YEAR = 0x2 }
 < Returns true if this time_locus is earlier than "to_compare" More...
 
- Public Types inherited from timely::clock_time
enum  time_formats {
  MERIDIAN = 0x1 , MILITARY = 0x2 , NO_AM_PM = 0x4 , SECONDS = 0x8 ,
  MILLISECONDS = 0x10
}
 An enumeration of time formatting modes used when printing the time. More...
 
- Public Types inherited from timely::day_in_year
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

 time_locus ()
 
 DEFINE_CLASS_NAME ("time_locus")
 
 time_locus (const clock_time &ct, const day_in_year &ytd, time_number year_in)
 Constructs a location in time given its components. More...
 
int packed_size () const
 Estimates the space needed for the packed structure. More...
 
virtual void pack (basis::byte_array &packed_form) const
 Packs a time_locus object into an array of bytes. More...
 
virtual bool unpack (basis::byte_array &packed_form)
 Unpacks a time_locus object from an array of bytes. More...
 
virtual bool equal_to (const basis::equalizable &s2) const
 
virtual bool less_than (const basis::orderable &s2) const
 
virtual void text_form (basis::base_string &state_fill) const
 Provides a text view of all the important info owned by this object. More...
 
basis::astring text_form_long (int t=clock_time::MERIDIAN, int d=day_in_year::SHORT_MONTH, int y=LONG_YEAR) const
 
void text_form_long (basis::astring &to_stuff, int t=clock_time::MERIDIAN, int d=day_in_year::SHORT_MONTH, int y=LONG_YEAR) const
 Prints out the time_locus given the way to print each component. More...
 
- Public Member Functions inherited from timely::clock_time
 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. More...
 
 ~clock_time ()
 
bool operator< (const clock_time &to_compare) const
 Returns true if this clock_time is earlier than "to_compare". More...
 
bool operator== (const clock_time &to_compare) const
 Returns true if this clock_time is equal to "to_compare". More...
 
basis::astring text_form (int how=MERIDIAN) const
 Prints the clock_time according to "how". More...
 
void text_form (basis::astring &to_stuff, int how=MERIDIAN) const
 Prints the time into "to_stuff" given "how". More...
 
- Public Member Functions inherited from timely::day_in_year
 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...
 
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...
 
- Public Member Functions inherited from basis::text_formable
virtual const char * class_name () const =0
 Returns the bare name of this class as a constant character pointer. More...
 
- Public Member Functions inherited from basis::equalizable
virtual bool operator== (const equalizable &s2) const
 the virtual method for object equality. More...
 

Static Public Member Functions

static time_number normalize (time_locus &to_fix)
 Same as text_form() above, but stores into "to_stuff". More...
 
- Static Public Member Functions inherited from timely::clock_time
static time_number normalize (clock_time &to_fix)
 
- Static Public Member Functions inherited from timely::day_in_year
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

time_number year
 The year, using the gregorian calendar. More...
 
- Public Attributes inherited from timely::clock_time
time_number hour
 The hour represented in military time: 0 through 23. More...
 
time_number minute
 The number of minutes after the hour. More...
 
time_number second
 The number of seconds after the current minute. More...
 
time_number millisecond
 The number of milliseconds elapsed in this second. More...
 
time_number microsecond
 Number of microseconds elapsed in this millisecond. More...
 
- Public Attributes inherited from timely::day_in_year
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 point in time.

It contains both a time of day and the day in the year.

Definition at line 186 of file earth_time.h.

Member Enumeration Documentation

◆ locus_formats

< Returns true if this time_locus is earlier than "to_compare"

< Returns true if this time_locus is equal to "to_compare" Enumerates the ways to show the year.

Enumerator
LONG_YEAR 

default: full four digit year (problems in 9999).

SHORT_YEAR 

use only last two digits of year. ugh–Y2K danger.

Definition at line 217 of file earth_time.h.

Constructor & Destructor Documentation

◆ time_locus() [1/2]

timely::time_locus::time_locus ( )
inline

Definition at line 192 of file earth_time.h.

◆ time_locus() [2/2]

timely::time_locus::time_locus ( const clock_time ct,
const day_in_year ytd,
time_number  year_in 
)
inline

Constructs a location in time given its components.

Definition at line 197 of file earth_time.h.

Member Function Documentation

◆ DEFINE_CLASS_NAME()

timely::time_locus::DEFINE_CLASS_NAME ( "time_locus"  )

◆ equal_to()

bool timely::time_locus::equal_to ( const basis::equalizable s2) const
virtual

Implements basis::equalizable.

Definition at line 269 of file earth_time.cpp.

References year.

◆ less_than()

bool timely::time_locus::less_than ( const basis::orderable s2) const
virtual

Definition at line 277 of file earth_time.cpp.

References EASY_LT, and year.

◆ normalize()

time_number timely::time_locus::normalize ( time_locus to_fix)
static

Same as text_form() above, but stores into "to_stuff".

normalizes the time_locus for its clock time and date.

Definition at line 307 of file earth_time.cpp.

References timely::day_in_year::day_in_month, and year.

◆ pack()

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

Packs a time_locus object into an array of bytes.

Reimplemented from timely::clock_time.

Definition at line 247 of file earth_time.cpp.

References basis::attach(), and structures::pack().

◆ packed_size()

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

Estimates the space needed for the packed structure.

Reimplemented from timely::clock_time.

Definition at line 200 of file earth_time.h.

References timely::clock_time::packed_size(), timely::day_in_year::packed_size(), and structures::PACKED_SIZE_INT32.

◆ text_form()

virtual void timely::time_locus::text_form ( basis::base_string state_fill) const
inlinevirtual

Provides a text view of all the important info owned by this object.

It is understood that there could be a large amount of information and that this function might take a relatively long time to complete.

Implements basis::text_formable.

Definition at line 223 of file earth_time.h.

References basis::base_string::assign(), LONG_YEAR, timely::clock_time::MERIDIAN, timely::day_in_year::SHORT_MONTH, and text_form_long().

◆ text_form_long() [1/2]

void timely::time_locus::text_form_long ( basis::astring to_stuff,
int  t = clock_time::MERIDIAN,
int  d = day_in_year::SHORT_MONTH,
int  y = LONG_YEAR 
) const

Prints out the time_locus given the way to print each component.

Definition at line 287 of file earth_time.cpp.

◆ text_form_long() [2/2]

astring timely::time_locus::text_form_long ( int  t = clock_time::MERIDIAN,
int  d = day_in_year::SHORT_MONTH,
int  y = LONG_YEAR 
) const

Definition at line 262 of file earth_time.cpp.

Referenced by timely::convert(), timely::time_stamp::notarize(), and text_form().

◆ unpack()

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

Unpacks a time_locus object from an array of bytes.

Reimplemented from timely::clock_time.

Definition at line 254 of file earth_time.cpp.

References basis::detach(), and structures::unpack().

Member Data Documentation

◆ year

time_number timely::time_locus::year

The year, using the gregorian calendar.

Definition at line 190 of file earth_time.h.

Referenced by timely::convert(), equal_to(), less_than(), normalize(), timely::time_control::set_time(), and timely::year_now().


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