1 #ifndef DATE_TIME_LOCAL_TIME_CONVERSION_HPP__ 2 #define DATE_TIME_LOCAL_TIME_CONVERSION_HPP__ 3 4 /* Copyright (c) 2003-2004 CrystalClear Software, Inc. 5 * Subject to the Boost Software License, Version 1.0. 6 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 7 * Author: Jeff Garland, Bart Garst 8 * $Date$ 9 */ 10 11 12 #include "boost/date_time/posix_time/conversion.hpp" 13 #include "boost/date_time/c_time.hpp" 14 #include "boost/date_time/local_time/local_date_time.hpp" 15 16 namespace boost { 17 namespace local_time { 18 19 //! Function that creates a tm struct from a local_date_time 20 inline to_tm(const local_date_time & lt)21std::tm to_tm(const local_date_time& lt) { 22 std::tm lt_tm = posix_time::to_tm(lt.local_time()); 23 if(lt.is_dst()){ 24 lt_tm.tm_isdst = 1; 25 } 26 else{ 27 lt_tm.tm_isdst = 0; 28 } 29 return lt_tm; 30 } 31 32 33 }} // namespaces 34 #endif // DATE_TIME_LOCAL_TIME_CONVERSION_HPP__ 35