/usr/include/boost/date_time
NameSizeModeActions
gregorian/-0755rm
local_time/-0755rm
posix_time/-0755rm
adjust_functors.hpp54670644editdlrm
compiler_config.hpp56400644editdlrm
constrained_value.hpp42240644editdlrm
c_local_time_adjustor.hpp26310644editdlrm
c_time.hpp44960644editdlrm
date.hpp73570644editdlrm
date_clock_device.hpp22990644editdlrm
date_defs.hpp7010644editdlrm
date_duration.hpp46690644editdlrm
date_duration_types.hpp91860644editdlrm
date_facet.hpp293140644editdlrm
date_formatting.hpp42080644editdlrm
date_formatting_limited.hpp34610644editdlrm
date_formatting_locales.hpp67480644editdlrm
date_format_simple.hpp31280644editdlrm
date_generators.hpp165080644editdlrm
date_generator_formatter.hpp117150644editdlrm
date_generator_parser.hpp130640644editdlrm
date_iterator.hpp33050644editdlrm
date_names_put.hpp107540644editdlrm
date_parsing.hpp141460644editdlrm
dst_rules.hpp154010644editdlrm
dst_transition_generators.hpp22930644editdlrm
filetime_functions.hpp31630644editdlrm
find_match.hpp13550644editdlrm
format_date_parser.hpp239090644editdlrm
gregorian_calendar.hpp27140644editdlrm
gregorian_calendar.ipp79470644editdlrm
int_adapter.hpp144630644editdlrm
iso_format.hpp56400644editdlrm
locale_config.hpp12060644editdlrm
local_timezone_defs.hpp76180644editdlrm
local_time_adjustor.hpp85780644editdlrm
microsec_time_clock.hpp62570644editdlrm
parse_format_base.hpp9610644editdlrm
period.hpp119360644editdlrm
period_formatter.hpp72370644editdlrm
period_parser.hpp79320644editdlrm
special_defs.hpp6330644editdlrm
special_values_formatter.hpp36570644editdlrm
special_values_parser.hpp61610644editdlrm
strings_from_facet.hpp45050644editdlrm
string_convert.hpp10020644editdlrm
string_parse_tree.hpp84050644editdlrm
time.hpp67880644editdlrm
time_clock.hpp22450644editdlrm
time_defs.hpp9420644editdlrm
time_duration.hpp105690644editdlrm
time_facet.hpp589880644editdlrm
time_formatting_streams.hpp37520644editdlrm
time_iterator.hpp14380644editdlrm
time_parsing.hpp118460644editdlrm
time_resolution_traits.hpp67600644editdlrm
time_system_counted.hpp90510644editdlrm
time_system_split.hpp80770644editdlrm
time_zone_base.hpp37110644editdlrm
time_zone_names.hpp31030644editdlrm
tz_db_base.hpp159150644editdlrm
wrapping_int.hpp58240644editdlrm
year_month_day.hpp13750644editdlrm
Edit: /usr/include/boost/date_time/gregorian_calendar.ipp (7947B)
/* Copyright (c) 2002,2003 CrystalClear Software, Inc. * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst * $Date$ */ namespace boost { namespace date_time { //! Return the day of the week (0==Sunday, 1==Monday, etc) /*! Converts a year-month-day into a day of the week number */ template BOOST_CXX14_CONSTEXPR inline unsigned short gregorian_calendar_base::day_of_week(const ymd_type& ymd) { unsigned short a = static_cast((14-ymd.month)/12); unsigned short y = static_cast(ymd.year - a); unsigned short m = static_cast(ymd.month + 12*a - 2); unsigned short d = static_cast((ymd.day + y + (y/4) - (y/100) + (y/400) + (31*m)/12) % 7); //std::cout << year << "-" << month << "-" << day << " is day: " << d << "\n"; return d; } //!Return the iso week number for the date /*!Implements the rules associated with the iso 8601 week number. Basically the rule is that Week 1 of the year is the week that contains January 4th or the week that contains the first Thursday in January. Reference for this algorithm is the Calendar FAQ by Claus Tondering, April 2000. */ template BOOST_CXX14_CONSTEXPR inline int gregorian_calendar_base::week_number(const ymd_type& ymd) { unsigned long julianbegin = julian_day_number(ymd_type(ymd.year,1,1)); unsigned long juliantoday = julian_day_number(ymd); unsigned long day = (julianbegin + 3) % 7; unsigned long week = (juliantoday + day - julianbegin + 4)/7; if ((week >= 1) && (week <= 52)) { return static_cast(week); } if (week == 53) { if((day==6) ||(day == 5 && is_leap_year(ymd.year))) { return static_cast(week); //under these circumstances week == 53. } else { return 1; //monday - wednesday is in week 1 of next year } } //if the week is not in current year recalculate using the previous year as the beginning year else if (week == 0) { julianbegin = julian_day_number(ymd_type(static_cast(ymd.year-1),1,1)); juliantoday = julian_day_number(ymd); day = (julianbegin + 3) % 7; week = (juliantoday + day - julianbegin + 4)/7; return static_cast(week); } return static_cast(week); //not reachable -- well except if day == 5 and is_leap_year != true } //! Convert a ymd_type into a day number /*! The day number is an absolute number of days since the start of count */ template BOOST_CXX14_CONSTEXPR inline date_int_type_ gregorian_calendar_base::day_number(const ymd_type& ymd) { unsigned short a = static_cast((14-ymd.month)/12); unsigned short y = static_cast(ymd.year + 4800 - a); unsigned short m = static_cast(ymd.month + 12*a - 3); unsigned long d = ymd.day + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045; return static_cast(d); } //! Convert a year-month-day into the julian day number /*! Since this implementation uses julian day internally, this is the same as the day_number. */ template BOOST_CXX14_CONSTEXPR inline date_int_type_ gregorian_calendar_base::julian_day_number(const ymd_type& ymd) { return day_number(ymd); } //! Convert year-month-day into a modified julian day number /*! The day number is an absolute number of days. * MJD 0 thus started on 17 Nov 1858(Gregorian) at 00:00:00 UTC */ template BOOST_CXX14_CONSTEXPR inline date_int_type_ gregorian_calendar_base::modjulian_day_number(const ymd_type& ymd) { return julian_day_number(ymd)-2400001; //prerounded } //! Change a day number into a year-month-day template BOOST_CXX14_CONSTEXPR inline ymd_type_ gregorian_calendar_base::from_day_number(date_int_type dayNumber) { date_int_type a = dayNumber + 32044; date_int_type b = (4*a + 3)/146097; date_int_type c = a-((146097*b)/4); date_int_type d = (4*c + 3)/1461; date_int_type e = c - (1461*d)/4; date_int_type m = (5*e + 2)/153; unsigned short day = static_cast(e - ((153*m + 2)/5) + 1); unsigned short month = static_cast(m + 3 - 12 * (m/10)); year_type year = static_cast(100*b + d - 4800 + (m/10)); //std::cout << year << "-" << month << "-" << day << "\n"; return ymd_type(static_cast(year),month,day); } //! Change a day number into a year-month-day template BOOST_CXX14_CONSTEXPR inline ymd_type_ gregorian_calendar_base::from_julian_day_number(date_int_type dayNumber) { date_int_type a = dayNumber + 32044; date_int_type b = (4*a+3)/146097; date_int_type c = a - ((146097*b)/4); date_int_type d = (4*c + 3)/1461; date_int_type e = c - ((1461*d)/4); date_int_type m = (5*e + 2)/153; unsigned short day = static_cast(e - ((153*m + 2)/5) + 1); unsigned short month = static_cast(m + 3 - 12 * (m/10)); year_type year = static_cast(100*b + d - 4800 + (m/10)); //std::cout << year << "-" << month << "-" << day << "\n"; return ymd_type(year,month,day); } //! Change a modified julian day number into a year-month-day template BOOST_CXX14_CONSTEXPR inline ymd_type_ gregorian_calendar_base::from_modjulian_day_number(date_int_type dayNumber) { date_int_type jd = dayNumber + 2400001; //is 2400000.5 prerounded return from_julian_day_number(jd); } //! Determine if the provided year is a leap year /*! *@return true if year is a leap year, false otherwise */ template BOOST_CXX14_CONSTEXPR inline bool gregorian_calendar_base::is_leap_year(year_type year) { //divisible by 4, not if divisible by 100, but true if divisible by 400 return (!(year % 4)) && ((year % 100) || (!(year % 400))); } //! Calculate the last day of the month /*! Find the day which is the end of the month given year and month * No error checking is performed. */ template BOOST_CXX14_CONSTEXPR inline unsigned short gregorian_calendar_base::end_of_month_day(year_type year, month_type month) { switch (month) { case 2: if (is_leap_year(year)) { return 29; } else { return 28; } case 4: case 6: case 9: case 11: return 30; default: return 31; } } //! Provide the ymd_type specification for the calendar start template BOOST_CXX14_CONSTEXPR inline ymd_type_ gregorian_calendar_base::epoch() { return ymd_type(1400,1,1); } //! Defines length of a week for week calculations template BOOST_CXX14_CONSTEXPR inline unsigned short gregorian_calendar_base::days_in_week() { return 7; } } } //namespace gregorian