x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
conversion.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\date_time\gregorian\conversion.hpp
旋转
特效
属性
历史版本
#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: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ */ #include
#include "boost/date_time/gregorian/gregorian_types.hpp" #include "boost/date_time/c_time.hpp" #if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) # if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS) # include "boost/date_time/gregorian/formatters_limited.hpp" # else # include "boost/date_time/gregorian/formatters.hpp" # endif // BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS #else # include
# include "boost/date_time/gregorian/gregorian_io.hpp" #endif // USE_DATE_TIME_PRE_1_33_FACET_IO 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_pos_infinity() || d.is_neg_infinity() || d.is_not_a_date()){ #if defined(USE_DATE_TIME_PRE_1_33_FACET_IO) std::string s("tm unable to handle date value of " + to_simple_string(d)); throw std::out_of_range(s); #else std::stringstream ss; ss << "tm unable to handle date value of " << d; throw std::out_of_range(ss.str()); #endif // USE_DATE_TIME_PRE_1_33_FACET_IO } std::tm 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_hour = datetm.tm_min = datetm.tm_sec = 0; 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
conversion.hpp
网页地址
文件地址
上一页 1/19
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.