/usr/include/boost/date_time/gregorian
NameSizeModeActions
conversion.hpp20670644editdlrm
formatters.hpp56270644editdlrm
formatters_limited.hpp27460644editdlrm
gregorian.hpp11630644editdlrm
gregorian_io.hpp285850644editdlrm
gregorian_types.hpp36310644editdlrm
greg_calendar.hpp15880644editdlrm
greg_date.hpp50110644editdlrm
greg_day.hpp19030644editdlrm
greg_day_of_year.hpp10940644editdlrm
greg_duration.hpp45010644editdlrm
greg_duration_types.hpp14570644editdlrm
greg_facet.hpp132250644editdlrm
greg_month.hpp45280644editdlrm
greg_serialize.hpp198500644editdlrm
greg_weekday.hpp31740644editdlrm
greg_year.hpp16800644editdlrm
greg_ymd.hpp8570644editdlrm
parsers.hpp42910644editdlrm
Edit: /usr/include/boost/date_time/gregorian/conversion.hpp (2067B)
#ifndef _GREGORIAN__CONVERSION_HPP___ #define _GREGORIAN__CONVERSION_HPP___ /* Copyright (c) 2004-2005 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$ */ #include #include #include #include #include #include #include namespace boost { namespace gregorian { //! Converts a date to a tm struct. Throws out_of_range exception if date is a special value inline std::tm to_tm(const date& d) { if (d.is_special()) { std::string s = "tm unable to handle "; switch (d.as_special()) { case date_time::not_a_date_time: s += "not-a-date-time value"; break; case date_time::neg_infin: s += "-infinity date value"; break; case date_time::pos_infin: s += "+infinity date value"; break; default: s += "a special date value"; break; } boost::throw_exception(std::out_of_range(s)); } std::tm datetm; std::memset(&datetm, 0, sizeof(datetm)); boost::gregorian::date::ymd_type ymd = d.year_month_day(); datetm.tm_year = ymd.year - 1900; datetm.tm_mon = ymd.month - 1; datetm.tm_mday = ymd.day; datetm.tm_wday = d.day_of_week(); datetm.tm_yday = d.day_of_year() - 1; datetm.tm_isdst = -1; // negative because not enough info to set tm_isdst return datetm; } //! Converts a tm structure into a date dropping the any time values. inline date date_from_tm(const std::tm& datetm) { return date(static_cast(datetm.tm_year+1900), static_cast(datetm.tm_mon+1), static_cast(datetm.tm_mday)); } } } //namespace boost::gregorian #endif