Chris@16: #ifndef POSIXTIME_PARSERS_HPP___ Chris@16: #define POSIXTIME_PARSERS_HPP___ Chris@16: Chris@16: /* Copyright (c) 2002,2003 CrystalClear Software, Inc. Chris@16: * Use, modification and distribution is subject to the Chris@16: * Boost Software License, Version 1.0. (See accompanying Chris@16: * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Author: Jeff Garland Chris@101: * $Date$ Chris@16: */ Chris@16: Chris@16: #include "boost/date_time/gregorian/gregorian.hpp" Chris@16: #include "boost/date_time/time_parsing.hpp" Chris@16: #include "boost/date_time/posix_time/posix_time_types.hpp" Chris@16: Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: namespace posix_time { Chris@16: Chris@16: //! Creates a time_duration object from a delimited string Chris@16: /*! Expected format for string is "[-]h[h][:mm][:ss][.fff]". Chris@16: * A negative duration will be created if the first character in Chris@16: * string is a '-', all other '-' will be treated as delimiters. Chris@16: * Accepted delimiters are "-:,.". */ Chris@16: inline time_duration duration_from_string(const std::string& s) { Chris@16: return date_time::parse_delimited_time_duration(s); Chris@16: } Chris@16: Chris@16: inline ptime time_from_string(const std::string& s) { Chris@16: return date_time::parse_delimited_time(s, ' '); Chris@16: } Chris@16: Chris@16: inline ptime from_iso_string(const std::string& s) { Chris@16: return date_time::parse_iso_time(s, 'T'); Chris@16: } Chris@16: Chris@16: Chris@16: Chris@16: } } //namespace posix_time Chris@16: Chris@16: Chris@16: #endif Chris@16: