Date Time Reference
Functor to iterate a fixed number of days.
date_type::duration_type
duration_type
const date_type &
duration_type
const date_type &
int
Provides calculation to find next nth month given a date.
This adjustment function provides the logic for 'month-based' advancement on a ymd based calendar. The policy it uses to handle the non existant end of month days is to back up to the last day of the month. Also, if the starting date is the last day of a month, this functor will attempt to adjust to the end of the month.
date_type::duration_type
date_type::calendar_type
cal_type::ymd_type
cal_type::day_type
duration_type
const date_type &
duration_type
const date_type &
Returns a negative duration_type.
int
Functor to iterate a over weeks.
date_type::duration_type
date_type::calendar_type
duration_type
const date_type &
duration_type
const date_type &
int
Functor to iterate by a year adjusting for leap years.
date_type::duration_type
duration_type
const date_type &
duration_type
const date_type &
int
Time adjustment calculations based on machine
Adjust to / from utc using the C API.
Warning!!! This class assumes that timezone settings of the machine are correct. This can be a very dangerous assumption.
time_type::time_duration_type
time_type::date_type
date_type::duration_type
time_type
const time_type &
Convert a utc time to local time.
Provide workarounds related to the ctime header
A template to specify a constrained basic value type.
This template provides a quick way to generate an integer type with a constrained range. The type provides for the ability to specify the min, max, and and error handling policy.
value policies A class that provides the range limits via the min and max functions as well as a function on_error that determines how errors are handled. A common strategy would be to assert or throw and exception. The on_error is passed both the current value and the new value that is in error.
value_policies::value_type
value_type
Coerce into the representation type.
value_type
value_type
value_type max
Return the max allowed value (traits method).
value_type min
Return the min allowed value (traits method).
void
value_type
rep_type
rep_type
Template to shortcut the constrained_value policy creation process.
rep_type
rep_type min
rep_type max
void
rep_type
rep_type
violation_enum
Represent a min or max violation type.
Representation of timepoint at the one day level resolution.
The date template represents an interface shell for a date class that is based on a year-month-day system such as the gregorian or iso systems. It provides basic operations to enable calculation and comparisons.
Theory
This date representation fundamentally departs from the C tm struct approach. The goal for this type is to provide efficient date operations (add, subtract) and storage (minimize space to represent) in a concrete class. Thus, the date uses a count internally to represent a particular date. The calendar parameter defines the policies for converting the the year-month-day and internal counted form here. Applications that need to perform heavy formatting of the same date repeatedly will perform better by using the year-month-day representation.
Internally the date uses a day number to represent the date. This is a monotonic time representation. This representation allows for fast comparison as well as simplifying the creation of writing numeric operations. Essentially, the internal day number is like adjusted julian day. The adjustment is determined by the Epoch date which is represented as day 1 of the calendar. Day 0 is reserved for negative infinity so that any actual date is automatically greater than negative infinity. When a date is constructed from a date or formatted for output, the appropriate conversions are applied to create the year, month, day representations.
T
calendar
calendar::date_traits_type
duration_type_
calendar::year_type
calendar::month_type
calendar::day_type
calendar::ymd_type
calendar::date_rep_type
calendar::date_int_type
calendar::day_of_week_type
year_type
month_type
day_type
day_of_week_type
ymd_type
bool
const date_type &
bool
const date_type &
bool
check to see if date is a special value
bool
check to see if date is not a value
bool
check to see if date is one of the infinity values
bool
check to see if date is greater than all possible dates
bool
check to see if date is greater than all possible dates
special_values
return as a special value or a not_special if a normal date
duration_type
const date_type &
date_type
const duration_type &
date_type
const duration_type &
date_rep_type
date_type
const duration_type &
date_type
const duration_type &
year_type
month_type
day_type
const ymd_type &
date_int_type
This is a private constructor which allows for the creation of new dates. It is not exposed to users since that would require class users to understand the inner workings of the date class.
date_rep_type
A clock providing day level services based on C time_t capabilities.
This clock uses Posix interfaces as its implementation and hence uses the timezone settings of the operating system. Incorrect user settings will result in incorrect results for the calls to local_day.
date_type::ymd_type
date_type
Get the local day as a date type.
date_type::ymd_type
Get the local day as a ymd_type.
date_type::ymd_type
Get the current day in universal date as a ymd_type.
date_type
Get the UTC day as a date type.
::std::tm *
::std::tm *
An enumeration of weekday names.
1
Simple enum to allow for nice programming with Jan, Feb, etc.
Duration type with date level resolution.
duration_rep_traits::int_type
duration_rep_traits::impl_type
duration_rep
returns days_ as it's instantiated type - used for streaming
bool
duration_rep_type
returns days as value, not object.
bool
const date_duration &
Equality.
bool
const date_duration &
Less.
date_duration
const date_duration &
Subtract another duration -- result is signed.
date_duration
const date_duration &
Add a duration -- result is signed.
date_duration
unary- Allows for dd = -date_duration(2); -> dd == -2
date_duration< duration_rep_traits >
int
Division operations on a duration with an integer.
date_duration< duration_rep_traits >
int
bool
return sign information
duration_rep
Construct from a day count.
special_values
construct from special_values - only works when instantiated with duration_traits_adapted
const date_duration< duration_rep_traits > &
Construct from another date_duration (Copy Constructor).
date_duration
Returns the smallest duration -- used by to calculate 'end'.
Struct for instantiating date_duration with NO special values functionality. Allows for transparent implementation of either date_duration<long> or date_duration<int_adapter<long> >
long
long
int_type
impl_type
Struct for instantiating date_duration WITH special values functionality. Allows for transparent implementation of either date_duration<long> or date_duration<int_adapter<long> >
long
boost::date_time::int_adapter< long >
int_type
impl_type
boost::date_time::date_duration< duration_config >
Additional duration type that represents a number of n*7 days.
typename duration_config::impl_type
special_values
additional duration type that represents a logical month
A logical month enables things like: "date(2002,Mar,2) + months(2) -> 2002-May2". If the date is a last day-of-the-month, the result will also be a last-day-of-the-month.
int_rep
duration_type
const date_type &
returns a negative duration
duration_type
const date_type &
bool
const months_type &
bool
const months_type &
months_type
const months_type &
months_type &
const months_type &
months_type
const months_type &
months_type &
const months_type &
months_type
const int_type
months_type &
const int_type
months_type
const int_type
months_type &
const int_type
months_type
const years_type &
months_type &
const years_type &
months_type
const years_type &
months_type &
const years_type &
int_rep
special_values
additional duration type that represents a logical year
A logical year enables things like: "date(2002,Mar,2) + years(2) -> 2004-Mar-2". If the date is a last day-of-the-month, the result will also be a last-day-of-the-month (ie date(2001-Feb-28) + years(3) -> 2004-Feb-29).
int_rep
duration_type
const date_type &
returns a negative duration
duration_type
const date_type &
bool
const years_type &
bool
const years_type &
years_type
const years_type &
years_type &
const years_type &
years_type
const years_type &
years_type &
const years_type &
years_type
const int_type
years_type &
const int_type
years_type
const int_type
years_type &
const int_type
months_type
const months_type &
months_type
const months_type &
int_rep
special_values
Class to provide simple basic formatting rules.
const charT *
String used printed is date is invalid.
const charT *
String used to for positive infinity value.
const charT *
String used to for positive infinity value.
month_format_spec
Describe month format.
ymd_order_spec
bool
This format uses '-' to separate date elements.
charT
Char to sep?
charT
char between year-month
charT
Char to separate month-day.
charT
char between date-hours
charT
char between hour and minute
charT
char for second
wchar_t
Specialization of formmating rules for wchar_t.
const wchar_t *
String used printed is date is invalid.
const wchar_t *
String used to for positive infinity value.
const wchar_t *
String used to for positive infinity value.
month_format_spec
Describe month format.
ymd_order_spec
bool
This format uses '-' to separate date elements.
wchar_t
Char to sep?
wchar_t
char between year-month
wchar_t
Char to separate month-day.
wchar_t
char between date-hours
wchar_t
char between hour and minute
wchar_t
char for second
char
Formats a month as as string into an ostream.
std::basic_ostream< charT > &
const month_type &
std::basic_ostream< charT > &
Formats a month as as string into an ostream.
This function demands that month_type provide functions for converting to short and long strings if that capability is used.
std::ostream &
const month_type &
std::ostream &
Formats a month as as string into an ostream.
This function demands that month_type provide functions for converting to short and long strings if that capability is used.
char
Convert ymd to a standard string formatting policies.
std::basic_string< charT >
ymd_type
Convert ymd to a standard string formatting policies.
This is standard code for handling date formatting with year-month-day based date information. This function uses the format_type to control whether the string will contain separator characters, and if so what the character will be. In addtion, it can format the month as either an integer or a string as controled by the formatting policy
std::string
ymd_type
Convert ymd to a standard string formatting policies.
This is standard code for handling date formatting with year-month-day based date information. This function uses the format_type to control whether the string will contain separator characters, and if so what the character will be. In addtion, it can format the month as either an integer or a string as controled by the formatting policy
char
Convert a date to string using format policies.
std::basic_string< charT >
string_type
date_type
Convert to a date to standard string using format policies.
std::string
date_type
Convert to a date to standard string using format policies.
char
Formats a month as as string into an ostream.
facet_type::month_type
std::basic_ostream< charT >
void
const month_type &
ostream_type &
const facet_type &
Formats a month as as string into an output iterator.
char
Formats a weekday.
facet_type::month_type
std::basic_ostream< charT >
void
const weekday_type &
ostream_type &
const facet_type &
bool
Formats a month as as string into an output iterator.
char
Convert ymd to a standard string formatting policies.
ymd_type::month_type
ostream_month_formatter< facet_type, charT >
std::basic_ostream< charT >
std::basic_string< charT >
void
ymd_type
ostream_type &
const facet_type &
Convert ymd to a standard string formatting policies.
This is standard code for handling date formatting with year-month-day based date information. This function uses the format_type to control whether the string will contain separator characters, and if so what the character will be. In addtion, it can format the month as either an integer or a string as controled by the formatting policy
char
Convert a date to string using format policies.
std::basic_ostream< charT >
date_type::ymd_type
void
const date_type &
ostream_type &
const facet_type &
Put date into an ostream.
void
const date_type &
ostream_type &
Put date into an ostream.
Definition and implementation of date algorithm templates
Base class for all generators that take a year and produce a date.
This class is a base class for polymorphic function objects that take a year and produce a concrete date.
date_type::calendar_type
calendar_type::year_type
virtual date_type
year_type
boost::date_time::year_based_generator< date_type >
Generates a date by applying the year to the given month and day.
Example usage: partial_date pd(1, Jan);
partial_date pd2(70);
date d = pd.get_date(2002); //2002-Jan-01
date d2 = pd2.get_date(2002); //2002-Mar-10
date_type::calendar_type
calendar_type::day_type
calendar_type::month_type
calendar_type::year_type
date_type::duration_type
duration_type::duration_rep
date_type
year_type
Return a concrete date when provided with a year specific year.
Will throw an 'invalid_argument' exception if a partial_date object, instantiated with Feb-29, has get_date called with a non-leap year. Example: partial_date pd(29, Feb);
pd.get_date(2003); // throws invalid_argument exception
pg.get_date(2000); // returns 2000-2-29
date_type
year_type
bool
const partial_date &
bool
const partial_date &
month_type
day_type
day_type
month_type
duration_rep
Partial date created from number of days into year. Range 1-366.
Allowable values range from 1 to 366. 1=Jan1, 366=Dec31. If argument exceeds range, partial_date will be created with closest in-range value. 60 will always be Feb29, if get_date() is called with a non-leap year an exception will be thrown
boost::date_time::year_based_generator< date_type >
Useful generator functor for finding holidays.
Based on the idea in Cal. Calc. for finding holidays that are the 'first Monday of September'. When instantiated with 'fifth' kday of month, the result will be the last kday of month which can be the fourth or fifth depending on the structure of the month.
The algorithm here basically guesses for the first day of the month. Then finds the first day of the correct type. That is, if the first of the month is a Tuesday and it needs Wenesday then we simply increment by a day and then we can add the length of a week until we get to the 'nth kday'. There are probably more efficient algorithms based on using a mod 7, but this one works reasonably well for basic applications.
date_type::calendar_type
calendar_type::day_of_week_type
calendar_type::month_type
calendar_type::year_type
date_type::duration_type
1
date_type
year_type
Return a concrete date when provided with a year specific year.
month_type
week_num
day_of_week_type
const char *
week_num
day_of_week_type
month_type
boost::date_time::year_based_generator< date_type >
Useful generator functor for finding holidays and daylight savings.
Similar to nth_kday_of_month, but requires less paramters
date_type::calendar_type
calendar_type::day_of_week_type
calendar_type::month_type
calendar_type::year_type
date_type::duration_type
date_type
year_type
Return a concrete date when provided with a year specific year.
month_type
day_of_week_type
day_of_week_type
The day of week, eg: Sunday, Monday, etc
month_type
The month of the year, eg: Jan, Feb, Mar, etc
Specify the first 'Sunday' in 'April' spec.
boost::date_time::year_based_generator< date_type >
Calculate something like Last Sunday of January.
Useful generator functor for finding holidays and daylight savings Get the last day of the month and then calculate the difference to the last previous day.
date_type::calendar_type
calendar_type::day_of_week_type
calendar_type::month_type
calendar_type::year_type
date_type::duration_type
date_type
year_type
Return a concrete date when provided with a year specific year.
month_type
day_of_week_type
day_of_week_type
The day of week, eg: Sunday, Monday, etc
month_type
The month of the year, eg: Jan, Feb, Mar, etc
Specify the date spec like last 'Sunday' in 'April' spec.
Calculate something like "First Sunday after Jan 1,2002.
Date generator that takes a date and finds kday after typedef boost::date_time::first_kday_after<date> firstkdayafter;
firstkdayafter fkaf(Monday);
fkaf.get_date(date(2002,Feb,1));
date_type::calendar_type
calendar_type::day_of_week_type
date_type::duration_type
date_type
date_type
Return next kday given.
day_of_week_type
day_of_week_type
Calculate something like "First Sunday before Jan 1,2002.
Date generator that takes a date and finds kday after typedef boost::date_time::first_kday_before<date> firstkdaybefore;
firstkdaybefore fkbf(Monday);
fkbf.get_date(date(2002,Feb,1));
date_type::calendar_type
calendar_type::day_of_week_type
date_type::duration_type
date_type
date_type
Return next kday given.
day_of_week_type
day_of_week_type
BOOST_DATE_TIME_DECL const char *
int
Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5.
date_type::duration_type
const date_type &
const weekday_type &
Calculates the number of days until the next weekday.
Calculates the number of days until the next weekday. If the date given falls on a Sunday and the given weekday is Tuesday the result will be 2 days
date_type::duration_type
const date_type &
const weekday_type &
Calculates the number of days since the previous weekday.
Calculates the number of days since the previous weekday If the date given falls on a Sunday and the given weekday is Tuesday the result will be 5 days. The answer will be a positive number because Tuesday is 5 days before Sunday, not -5 days before.
date_type
const date_type &
const weekday_type &
Generates a date object representing the date of the following weekday from the given date.
Generates a date object representing the date of the following weekday from the given date. If the date given is 2004-May-9 (a Sunday) and the given weekday is Tuesday then the resulting date will be 2004-May-11.
date_type
const date_type &
const weekday_type &
Generates a date object representing the date of the previous weekday from the given date.
Generates a date object representing the date of the previous weekday from the given date. If the date given is 2004-May-9 (a Sunday) and the given weekday is Tuesday then the resulting date will be 2004-May-4.
Base date iterator type.
This class provides the skeleton for the creation of iterators. New and interesting interators can be created by plugging in a new function that derives the next value from the current state. generation of various types of -based information.
Template Parameters
date_type
The date_type is a concrete date_type. The date_type must define a duration_type and a calendar_type.
date_type::duration_type
date_type
std::input_iterator_tag
date_itr_base &
date_itr_base &
virtual duration_type
const date_type &
virtual duration_type
const date_type &
date_type
date_type *
bool
const date_type &
bool
const date_type &
bool
const date_type &
bool
const date_type &
bool
const date_type &
bool
const date_type &
date_type
boost::date_time::date_itr_base< date_type >
Overrides the base date iterator providing hook for functors.
date_type::duration_type
date_type
int
1
virtual duration_type
const date_type &
virtual duration_type
const date_type &
An iterator over dates with varying resolution (day, week, month, year, etc).
char
std::ostreambuf_iterator<charT>
Output facet base class for gregorian dates.
This class is a base class for date facets used to localize the names of months and the names of days in the week.
Requirements of Config
define an enumeration month_enum that enumerates the months. The enumeration should be '1' based eg: Jan==1define as_short_string and as_long_string
(see langer & kreft p334).
OutputIterator
Config::month_type
Config::month_enum
Config::weekday_enum
Config::special_value_enum
std::basic_string< charT >
void
iter_type &
special_value_enum
void
iter_type &
month_enum
void
iter_type &
month_enum
void
iter_type &
weekday_enum
void
iter_type &
weekday_enum
bool
void
iter_type &
void
iter_type &
char between year-month
void
iter_type &
Char to separate month-day.
ymd_order_spec
Determines the order to put the date elements.
month_format_spec
Determines if month is displayed as integer, short or long string.
std::locale::id
Generate storage location for a std::locale::id.
virtual void
iter_type &
month_enum
Default facet implementation uses month_type defaults.
virtual void
iter_type &
month_enum
Default facet implementation uses month_type defaults.
virtual void
iter_type &
special_value_enum
Default facet implementation for special value types.
virtual void
iter_type &
weekday_enum
virtual void
iter_type &
weekday_enum
virtual bool
virtual void
iter_type &
virtual void
iter_type &
char between year-month
virtual void
iter_type &
Char to separate month-day.
virtual ymd_order_spec
Default for date order.
virtual month_format_spec
Default month format.
void
iter_type &
const charT *const
void
iter_type &
const string_type &
char
std::ostreambuf_iterator<charT>
boost::date_time::date_names_put< Config, charT, OutputIterator >
An date name output facet that takes an array of char* to define strings.
OutputIterator
Config::month_enum
Config::weekday_enum
Config::special_value_enum
const charT *const *
const charT *const *
const charT *const *
const charT *const *
const charT *const *
const charT *const
const charT *const
const charT *const
const charT *const
const charT *const
charT
'-'
ymd_order_spec
ymd_order_iso
month_format_spec
month_as_short_string
virtual void
iter_type &
month_enum
Generic facet that takes array of chars.
virtual void
iter_type &
month_enum
Long month names.
virtual void
iter_type &
special_value_enum
Special values names.
virtual void
iter_type &
weekday_enum
virtual void
iter_type &
weekday_enum
virtual void
iter_type &
char between year-month
virtual void
iter_type &
Char to separate month-day.
virtual ymd_order_spec
Set the date ordering.
virtual month_format_spec
Set the date ordering.
Contains template class to provide static dst rule calculations
Dynamic class used to caluclate dst transition information.
time_duration_type_
date_type_
time_is_dst_result
const time_duration_type &
Time offset in the day for the local time
unsigned int
Local day offset for start of dst
long
Number of minutes to adjust clock forward
Check the local time offset when on dst start day.
On this dst transition, the time label between the transition boundary and the boudary + the offset are invalid times. If before the boundary then still not in dst.
time_is_dst_result
const time_duration_type &
Time offset in the day for the local time
unsigned int
Local time of day for end of dst
long
Check the local time offset when on the last day of dst.
This is the calculation for the DST end day. On that day times prior to the conversion time - dst_length (1 am in US) are still in dst. Times between the above and the switch time are ambiguous. Times after the start_offset are not in dst.
time_is_dst_result
const date_type &
The day to check for dst
const time_duration_type &
Time offset within the day to check
const date_type &
Starting day of dst for the given locality
unsigned int
Offset within day for dst boundary (eg 120 for US which is 02:00:00)
const date_type &
Ending day of dst for the given locality
unsigned int
Offset within day given in dst for dst boundary (eg 120 for US which is 02:00:00)
long
Length of dst adjusment (eg: 60 for US)
Calculates if the given local time is dst or not.
Determines if the time is really in DST or not. Also checks for invalid and ambiguous.
Compile-time configurable daylight savings time calculation engine.
date_type::year_type
date_type::calendar_type
dst_calculator< date_type, time_duration_type >
time_is_dst_result
const date_type &
const time_duration_type &
Calculates if the given local time is dst or not.
Determines if the time is really in DST or not. Also checks for invalid and ambiguous.
bool
date_type
time_duration_type
The time of day for the dst transition (eg: typically 01:00:00 or 02:00:00).
date_type
year_type
date_type
year_type
unsigned int120
short60
Depricated: Class to calculate dst boundaries for US time zones.
time_duration_type_
date_type_
date_type::year_type
date_type::calendar_type
date_time::last_kday_of_month< date_type >
date_time::first_kday_of_month< date_type >
dst_calculator< date_type, time_duration_type >
time_is_dst_result
const date_type &
const time_duration_type &
Calculates if the given local time is dst or not.
Determines if the time is really in DST or not. Also checks for invalid and ambiguous.
bool
date_type
date_type
year_type
date_type
year_type
time_duration_type
Used for local time adjustments in places that don't use dst.
time_duration_type_
date_type_
time_is_dst_result
const date_type &
const time_duration_type &
Calculates if the given local time is dst or not.
time_is_dst_result
const date_type &
const time_duration_type &
Calculates if the given utc time is in dst.
bool
date_type
time_duration_type
Defines base interface for calculating start and end date of daylight savings.
date_type::year_type
virtual date_type
year_type
virtual date_type
year_type
boost::date_time::dst_day_calc_rule< spec::date_type >
Canonical form for a class that provides day rule calculation.
This class is used to generate specific sets of dst rules
spec::date_type
date_type::year_type
spec::start_rule
spec::end_rule
virtual date_type
year_type
virtual date_type
year_type
start_rule
end_rule
Function(s) for converting between a FILETIME structure and a time object. This file is only available on systems that have BOOST_HAS_FTIME defined.
time_type
const FILETIME &
Create a time object from an initialized FILETIME struct.
Create a time object from an initialized FILETIME struct. A FILETIME struct holds 100-nanosecond units (0.0000001). When built with microsecond resolution the FILETIME's sub second value will be truncated. Nanosecond resolution has no truncation.
An implementation of the Gregorian calendar.
This is a parameterized implementation of a proleptic Gregorian Calendar that can be used in the creation of date systems or just to perform calculations. All the methods of this class are static functions, so the intent is to never create instances of this class.
define a type a date split into components
ymd_type_
define a type for representing months
ymd_type::month_type
define a type for representing days
ymd_type::day_type
Type to hold a stand alone year value (eg: 2002).
ymd_type::year_type
Define the integer type to use for internal calculations.
date_int_type_
unsigned short
const ymd_type &
int
const ymd_type &
date_int_type
const ymd_type &
date_int_type
const ymd_type &
long
const ymd_type &
ymd_type
date_int_type
ymd_type
date_int_type
ymd_type
long
bool
year_type
unsigned short
year_type
month_type
ymd_type
unsigned short
Adapter to create integer types with +-infinity, and not a value.
This class is used internally in counted date/time representations. It adds the floating point like features of infinities and not a number. It also provides mathmatical operations with consideration to special values following these rules: +infinity - infinity == Not A Number (NAN)
infinity * non-zero == infinity
infinity * zero == NAN
+infinity * -integer == -infinity
infinity / infinity == NAN
infinity * infinity == infinity
*
int_type_
bool
bool
bool
bool
bool
bool
const int_adapter &
bool
const int &
bool
const int_adapter &
bool
const int &
bool
const int_adapter &
bool
const int &
bool
const int_adapter &
int_type
special_values
Returns either special value type or is_not_special.
int_adapter
const int_adapter< rhs_type > &
Operator allows for adding dissimilar int_adapter types. The return type will match that of the the calling object's type
int_adapter
const int_type
int_adapter
const int_adapter< rhs_type > &
Operator allows for subtracting dissimilar int_adapter types. The return type will match that of the the calling object's type
int_adapter
const int_type
int_adapter
const int_adapter &
int_adapter
const int
Provided for cases when automatic conversion from 'int' to 'int_adapter' causes incorrect results.
int_adapter
const int_adapter &
int_adapter
const int
Provided for cases when automatic conversion from 'int' to 'int_adapter' causes incorrect results.
int_adapter
const int_adapter &
int_adapter
const int
Provided for cases when automatic conversion from 'int' to 'int_adapter' causes incorrect results.
int_type
bool
const int_adapter
const int_adapter
const int_adapter
int_adapter max
int_adapter min
int_adapter
special_values
bool
int_type
bool
int_type
bool
int_type
bool
int_type
special_values
int_type
Returns either special value type or is_not_special.
int_type
int
const int_adapter &
returns -1, 0, 1, or 2 if 'this' is <, ==, >, or 'nan comparison' rhs
int_adapter
const int_adapter &
Assumes at least 'this' or 'rhs' is a special value.
int_adapter
const int &
Assumes 'this' is a special value.
std::basic_ostream< charT, traits > &
std::basic_ostream< charT, traits > &
const int_adapter< int_type > &
Expected output is either a numeric representation or a special values representation.
Ex. "12", "+infinity", "not-a-number", etc.
Class to provide common iso formatting spec.
month_format_spec
Describe month format -- its an integer in iso format.
const charT *
String used printed is date is invalid.
const charT *
String used to for positive infinity value.
const charT *
String used to for positive infinity value.
charT
ISO char for a year -- used in durations.
charT
ISO char for a month.
charT
ISO char for a day.
charT
char for minute
charT
char for minute
charT
char for second
charT
ISO char for a period.
charT
Used in time in mixed strings to set start of time.
charT
Used in mixed strings to identify start of a week number.
charT
Separators for periods.
charT
Separator for hh:mm:ss.
charT
Preferred Separator for hh:mm:ss,decimal_fraction.
bool
charT
bool
charT
bool
charT
charT
wchar_t
Class to provide common iso formatting spec.
month_format_spec
Describe month format -- its an integer in iso format.
const wchar_t *
String used printed is date is invalid.
const wchar_t *
String used to for positive infinity value.
const wchar_t *
String used to for positive infinity value.
wchar_t
ISO char for a year -- used in durations.
wchar_t
ISO char for a month.
wchar_t
ISO char for a day.
wchar_t
char for minute
wchar_t
char for minute
wchar_t
char for second
wchar_t
ISO char for a period.
wchar_t
Used in time in mixed strings to set start of time.
wchar_t
Used in mixed strings to identify start of a week number.
wchar_t
Separators for periods.
wchar_t
Separator for hh:mm:ss.
wchar_t
Preferred Separator for hh:mm:ss,decimal_fraction.
bool
wchar_t
bool
wchar_t
bool
wchar_t
wchar_t
boost::date_time::iso_format_base< charT >
Format description for iso normal YYYYMMDD.
bool
The ios standard format doesn't use char separators.
boost::date_time::iso_format_base< charT >
Extended format uses seperators YYYY-MM-DD.
bool
Extended format needs char separators.
Time adjustment calculations for local times
short
unsigned short0
Provides a base offset adjustment from utc.
time_duration_type
time_duration_type
Allow sliding utc adjustment with fixed dst rules.
time_type::time_duration_type
time_type::date_type
time_duration_type
bool
Presumes local time.
time_duration_type
Embed the rules for local time adjustments at compile time.
time_type::time_duration_type
time_type::date_type
time_duration_type
const time_type &
UTC time to calculate offset to local time This adjustment depends on the following observations about the workings of the DST boundary offset. Since UTC time labels are monotonically increasing we can determine if a given local time is in DST or not and therefore adjust the offset appropriately.
Calculates the offset from a utc time to local based on dst and utc offset.
The logic is as follows. Starting with UTC time use the offset to create a label for an non-dst adjusted local time. Then call dst_rules::local_is_dst with the non adjust local time. The results of this function will either unabiguously decide that the initial local time is in dst or return an illegal or ambiguous result. An illegal result only occurs at the end of dst (where labels are skipped) and indicates that dst has ended. An ambiguous result means that we need to recheck by making a dst adjustment and then rechecking. If the dst offset is added to the utc time and the recheck proves non-ambiguous then we are past the boundary. If it is still ambiguous then we are ahead of the boundary and dst is still in effect.
TODO -- check if all dst offsets are positive. If not then the algorithm needs to check for this and reverse the illegal/ambiguous logic.
time_duration_type
const time_type &
date_time::dst_flags
date_time::calculate
Get the offset to UTC given a local time.
short
Template that simplifies the creation of local time calculator.
Use this template to create the timezone to utc convertors as required.
This class will also work for other regions that don't use dst and have a utc offset which is an integral number of hours.
Template Parameters -time_type -- Time class to use -utc_offset -- Number hours local time is adjust from utc -use_dst -- true (default) if region uses dst, false otherwise For example: //eastern timezone is utc-5
typedef date_time::local_adjustor<ptime, -5, us_dst> us_eastern;
typedef date_time::local_adjustor<ptime, -6, us_dst> us_central;
typedef date_time::local_adjustor<ptime, -7, us_dst> us_mountain;
typedef date_time::local_adjustor<ptime, -8, us_dst> us_pacific;
typedef date_time::local_adjustor<ptime, -7, no_dst> us_arizona;
time_type::time_duration_type
time_type::date_type
static_local_time_adjustor< time_type, dst_rule, utc_adjustment< time_duration_type, utc_offset > >
time_type
const time_type &
Convert a utc time to local time.
time_type
const time_type &
date_time::dst_flags
date_time::calculate
Convert a local time to utc.
void
Specification for daylight savings start rules in US.
This class is used to configure dst_calc_engine template typically as follows: using namespace boost::gregorian;
using namespace boost::posix_time;
typedef us_dst_trait<date> us_dst_traits;
typedef boost::date_time::dst_calc_engine<date, time_duration,
us_dst_traits>
us_dst_calc;
//calculate the 2002 transition day of USA April 7 2002
date dst_start = us_dst_calc::local_dst_start_day(2002);
//calculate the 2002 transition day of USA Oct 27 2002
date dst_end = us_dst_calc::local_dst_end_day(2002);
//check if a local time is in dst or not -- posible answers
//are yes, no, invalid time label, ambiguous
ptime t(...some time...);
if (us_dst::local_is_dst(t.date(), t.time_of_day())
== boost::date_time::is_not_in_dst)
{
}
This generates a type suitable for the calculation of dst transitions for the United States. Of course other templates can be used for other locales.
date_type::day_of_week_type
date_type::month_type
date_time::first_kday_of_month< date_type >
date_time::last_kday_of_month< date_type >
day_of_week_type
month_type
day_of_week_type
month_type
int
int
int
Rules for daylight savings start in the EU (Last Sun in Mar).
These amount to the following:
Start of dst day is last Sunday in MarchEnd day of dst is last Sunday in OctGoing forward switch time is 2:00 am (offset 120 minutes)Going back switch time is 3:00 am (off set 180 minutes)Shift duration is one hour (60 minutes)
date_type::day_of_week_type
date_type::month_type
date_time::last_kday_of_month< date_type >
date_time::last_kday_of_month< date_type >
day_of_week_type
month_type
day_of_week_type
month_type
int
int
int
boost::date_time::eu_dst_trait< date_type >
Alternative dst traits for some parts of the United Kingdom.
int
int
int
date_type::day_of_week_type
date_type::month_type
date_time::last_kday_of_month< date_type >
date_time::last_kday_of_month< date_type >
day_of_week_type
month_type
day_of_week_type
month_type
int
int
int
This file contains a high resolution time clock implementation.
A clock providing microsecond level resolution.
A high precision clock that measures the local time at a resolution up to microseconds and adjusts to the resolution of the time system. For example, for the a library configuration with nano second resolution, the last 3 places of the fractional seconds will always be 000 since there are 1000 nano-seconds in a micro second.
time_type::date_type
time_type::time_duration_type
time_duration_type::rep_type
time_type
Return the local time based on computer clock settings.
time_type
timeval *
time_type
Return the local time based on computer clock settings.
time_type
FILETIME &
Enum for distinguishing parsing and formatting options.
Enum for distinguishing the order of Month, Day, & Year.
Enum for distinguishing the order in which Month, Day, & Year will appear in a date string
This file contain the implementation of the period abstraction. This is basically the same idea as a range. Although this class is intended for use in the time library, it is pretty close to general enough for other numeric uses.
Provides generalized period type useful in date-time systems.
This template uses a class to represent a time point within the period and another class to represent a duration. As a result, this class is not appropriate for use when the number and duration representation are the same (eg: in the regular number domain).
A period can be specified by providing either the starting point and a duration or the starting point and the end point( end is NOT part of the period but 1 unit past it. A period will be "invalid" if either start_point >= end_point or the given duration is < 0. Any valid period will return false for is_null().
Zero length periods are considered valid. In this case the start point is exactly 1 unit less than the end point, in other words start is equal to last.
In the case that the begin and last are the same, the period has a length of zero units. For example, suppose this is a period of days. That is, each time-point represents a single day. If the start and the last is the same day then the period is zero length.
The best way to handle periods is usually to provide a start point and a duration. So, day1 + 7 days is a week period which includes all of the first day and 6 more days (eg: Sun to Sat).
point_rep
duration_rep
point_rep
Return the first element in the period.
point_rep
Return one past the last element.
point_rep
Return the last item in the period.
duration_rep
Return the length of the period.
bool
True if period is ill formed (length less than zero).
bool
const period &
Equality operator.
bool
const period &
Strict as defined by rhs.last <= lhs.last.
void
const duration_rep &
Shift the start and end by the specified amount.
bool
const point_rep &
True if the point is inside the period.
bool
const period &
True if this period fully contains (or equals) the other period.
bool
const period &
True if the periods overlap in any way.
bool
const period &
True if periods are next to each other without a gap.
bool
const point_rep &
True if all of the period is prior to the passed point or end <= t.
bool
const point_rep &
True if all of the period is prior or t < start.
period
const period &
Returns the period of intersection or invalid range no intersection.
period
const period &
Returns the union of intersecting periods -- or null period.
period
const period &
Combine two periods with earliest start and latest end.
Combines two periods and any gap between them such that start = min(p1.start, p2.start) end = max(p1.end , p2.end) [---p1---)
[---p2---)
result:
[-----------p3----------)
*
point_rep
point_rep
create a period from begin to last eg: [begin,end)
If end <= begin then the period will be invalid
point_rep
duration_rep
create a period as [begin, begin+len)
If len is < 0 then the period will be invalid
This file contains the interface for the time associated classes.
Representation of a precise moment in time, including the date.
This class is a skeleton for the interface of a temporal type with a resolution that is higher than a day. It is intended that this class be the base class and that the actual time class be derived using the BN pattern. In this way, the derived class can make decisions such as 'should there be a default constructor' and what should it set its value to, should there be optional constructors say allowing only an time_durations that generate a time from a clock,etc. So, in fact multiple time types can be created for a time_system with different construction policies, and all of them can perform basic operations by only writing a copy constructor. Finally, compiler errors are also shorter.
The real behavior of the time class is provided by the time_system template parameter. This class must provide all the logic for addition, subtraction, as well as define all the interface types.
T
time_system::time_rep_type
time_system::date_type
time_system::date_duration_type
time_system::time_duration_type
date_type
time_duration_type
std::string
bool
check to see if date is not a value
bool
check to see if date is one of the infinity values
bool
check to see if date is greater than all possible dates
bool
check to see if date is greater than all possible dates
bool
const time_type &
Equality operator -- others generated by boost::equality_comparable.
bool
const time_type &
Equality operator -- others generated by boost::less_than_comparable.
time_duration_type
const time_type &
difference between two times
time_type
const date_duration_type &
add date durations
time_type
const date_duration_type &
time_type
const date_duration_type &
subtract date durations
time_type
const date_duration_type &
time_type
const time_duration_type &
add time durations
time_type
const time_duration_type &
time_type
const time_duration_type &
subtract time durations
time_type
const time_duration_type &
const date_type &
const time_duration_type &
dst_flags
not_dst
const time_rep_type &
This file contains the interface for clock devices.
A clock providing time level services based on C time_t capabilities.
This clock provides resolution to the 1 second level
time_type::time_duration_type
time_type
time_type
Get the current day in universal date as a ymd_type.
time_type
::std::tm *
This file contains nice definitions for handling the resoluion of various time reprsentations.
Defines some nice types for handling time level resolutions.
Flags for daylight savings or summer time.
Represents some amount of elapsed time measure to a given resolution.
This class represents a standard set of capabilities for all counted time durations. Time duration implementations should derive from this class passing their type as the first template parameter. This design allows the subclass duration types to provide custom construction policies or other custom features not provided here.
T
rep_type
rep_type::day_type
rep_type::hour_type
rep_type::min_type
rep_type::sec_type
rep_type::fractional_seconds_type
rep_type::tick_type
rep_type::impl_type
hour_type
Returns number of hours in the duration.
min_type
Returns normalized number of minutes.
sec_type
Returns normalized number of seconds (0..60).
sec_type
Returns total number of seconds truncating any fractional seconds.
tick_type
Returns total number of milliseconds truncating any fractional seconds.
tick_type
Returns total number of nanoseconds truncating any sub millisecond values.
tick_type
Returns total number of microseconds truncating any sub microsecond values.
fractional_seconds_type
Returns count of fractional seconds at given resolution.
duration_type
bool
bool
const time_duration &
bool
const time_duration &
duration_type
unary- Allows for time_duration td = -td1
duration_type
const duration_type &
duration_type
const duration_type &
duration_type
int
duration_type
const duration_type &
duration_type
const duration_type &
duration_type
int
Division operations on a duration with an integer.
duration_type
int
Multiplication operations an a duration with an integer.
duration_type
int
tick_type
bool
Is ticks_ a special value?
bool
Is duration pos-infinity.
bool
Is duration neg-infinity.
bool
Is duration not-a-date-time.
impl_type
Used for special_values output.
hour_type
min_type
sec_type
0
fractional_seconds_type
0
const time_duration< T, rep_type > &
Construct from another time_duration (Copy constructor).
special_values
Construct from special_values.
duration_type
Returns smallest representable duration.
tick_type
Return the number of ticks in a second.
time_resolutions
Provide the resolution of this duration type.
unsigned short
Returns number of possible digits in fractional seconds.
impl_type
long
Template for instantiating derived adjusting durations.
base_duration::traits_type
long
char
Put a time type into a stream using appropriate facets.
std::basic_ostream< charT >
time_duration_type::fractional_seconds_type
void
const time_duration_type &
ostream_type &
Put time into an ostream.
char
Put a time type into a stream using appropriate facets.
std::basic_ostream< charT >
time_type::date_type
time_type::time_duration_type
ostream_time_duration_formatter< time_duration_type, charT >
void
const time_type &
ostream_type &
Put time into an ostream.
char
Put a time period into a stream using appropriate facets.
std::basic_ostream< charT >
time_period_type::point_type
ostream_time_formatter< time_type, charT >
void
const time_period_type &
ostream_type &
Put time into an ostream.
Simple time iterator skeleton class.
time_type::time_duration_type
time_itr &
time_itr &
time_type
time_type *
bool
const time_type &
bool
const time_type &
bool
const time_type &
bool
const time_type &
bool
const time_type &
bool
const time_type &
time_type
time_duration_type
time_duration
const std::string &
Creates a time_duration object from a delimited string.
Expected format for string is "[-]h[h][:mm][:ss][.fff]". A negative duration will be created if the first character in string is a '-', all other '-' will be treated as delimiters. Accepted delimiters are "-:,.".
bool
const std::string &
char
std::string &
std::string &
Utility function to split appart string.
time_type
const std::string &
char
time_duration
const std::string &
Parse time duration part of an iso time of form: [-]hhmmss (eg: 120259 is 12 hours 2 min 59 seconds).
time_type
const std::string &
char
Parse time string of form YYYYMMDDThhmmss where T is delimeter between date and time.
traits struct for time_resolution_traits implementation type
boost::int32_t
boost::int32_t
int_type
impl_type
bool
Used to determine if implemented type is int_adapter or int.
traits struct for time_resolution_traits implementation type
boost::int32_t
boost::date_time::int_adapter< boost::int32_t >
int_type
impl_type
bool
Used to determine if implemented type is int_adapter or int.
traits struct for time_resolution_traits implementation type
boost::int64_t
boost::int64_t
int_type
impl_type
bool
Used to determine if implemented type is int_adapter or int.
traits struct for time_resolution_traits implementation type
boost::int64_t
boost::date_time::int_adapter< boost::int64_t >
int_type
impl_type
bool
Used to determine if implemented type is int_adapter or int.
time_resolutions
#if(defined(BOOST_MSVC)&&(_MSC_VER<=1200)) boost::int64_t
#else typename frac_sec_type::int_type
#endif unsigned short
boost::int32_t
frac_sec_type::int_type
frac_sec_type::int_type
frac_sec_type::impl_type
v_type
v_type
v_type
v_type
int
ticks_per_second
resolution_adjust
frac_sec_type::int_type
typename frac_sec_type::impl_type
bool
time_resolutions
unsigned short
fractional_seconds_type
tick_type
hour_type
min_type
sec_type
fractional_seconds_type
Any negative argument results in a negative tick_count.
time_resolution_traits< time_resolution_traits_adapted32_impl, milli, 1000, 3 >
time_resolution_traits< time_resolution_traits_adapted64_impl, micro, 1000000, 6 >
time_resolution_traits< time_resolution_traits_adapted64_impl, nano, 1000000000, 9 >
T
T
Simple function to calculate absolute value of a numeric type.
Time representation that uses a single integer count.
config::int_type
config::date_type
config::impl_type
date_type::duration_type
date_type::calendar_type
date_type::ymd_type
config::time_duration_type
config::resolution_traits
date_type
int_type
int_type
int_type
bool
bool
bool
bool
impl_type
const date_type &
const time_duration_type &
int_type
impl_type
int_type
An unadjusted time system implementation.
time_rep
time_rep_type::impl_type
time_rep_type::time_duration_type
time_duration_type::fractional_seconds_type
time_rep_type::date_type
time_rep_type::date_duration_type
void
const T &
time_rep_type
const date_type &
const time_duration_type &
date_time::dst_flags
not_dst
date_type
const time_rep_type &
time_duration_type
const time_rep_type &
std::string
const time_rep_type &
bool
const time_rep_type &
const time_rep_type &
bool
const time_rep_type &
const time_rep_type &
time_rep_type
const time_rep_type &
const date_duration_type &
time_rep_type
const time_rep_type &
const date_duration_type &
time_rep_type
const time_rep_type &
const time_duration_type &
time_rep_type
const time_rep_type &
time_duration_type
time_duration_type
const time_rep_type &
const time_rep_type &
boost::int32_t
An unadjusted time system implementation.
config::time_rep_type
config::date_type
config::time_duration_type
config::date_duration_type
config::int_type
config::resolution_traits
date_time::wrapping_int< int_type, INT64_C(86400)*ticks_per_second
date_time::wrapping_int< int_type, ticks_per_day >
time_rep_type
const date_type &
const time_duration_type &
date_time::dst_flags
not_dst
date_type
const time_rep_type &
time_duration_type
const time_rep_type &
std::string
const time_rep_type &
bool
const time_rep_type &
const time_rep_type &
bool
const time_rep_type &
const time_rep_type &
time_rep_type
const time_rep_type &
const date_duration_type &
time_rep_type
const time_rep_type &
const date_duration_type &
time_rep_type
const time_rep_type &
const time_duration_type &
time_rep_type
const time_rep_type &
time_duration_type
time_duration_type
const time_rep_type &
const time_rep_type &
int_type
ticks_per_day
INT64_C(86400)*config::tick_per_second
int_type_
A wrapping integer used to support time durations.
In composite date and time types this type is used to wrap at the day boundary.
int_type_
int_type
Explicit converion method.
int_type
int_type
int_type
int_type
int_type
int_type
Add, return true if wrapped.
int_type
int_type_
int_type_
A wrapping integer used to wrap around at the top.
Bad name, quick impl to fix a bug -- fix later!! This allows the wrap to restart at a value other than 0. Currently this only works if wrap_min == 1
int_type_
int_type
Explicit converion method.
int_type
int_type
int_type
Add, return number of wraps performed.
int_type
int_type
Subtract will return '-d' if wrapping took place ('d' is the number of wraps).
int_type
If initializing value is out of range of [wrap_min, wrap_max], value will be initialized to closest of min or max
unsigned long
unsigned long
Allow rapid creation of ymd triples of different types.
YearType
MonthType
DayType
YearType
MonthType
DayType
A basic constructor.
YearType
MonthType
DayType