source: NonGTP/Boost/boost/date_time/posix_time/time_parsers.hpp @ 857

Revision 857, 1.3 KB checked in by igarcia, 19 years ago (diff)
Line 
1#ifndef POSIXTIME_PARSERS_HPP___
2#define POSIXTIME_PARSERS_HPP___
3
4/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
5 * Use, modification and distribution is subject to the
6 * Boost Software License, Version 1.0. (See accompanying
7 * file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0)
8 * Author: Jeff Garland
9 * $Date: 2003/11/23 02:37:57 $
10 */
11
12#include "boost/date_time/gregorian/gregorian.hpp"
13#include "boost/date_time/time_parsing.hpp"
14#include "boost/date_time/posix_time/posix_time_types.hpp"
15
16 
17namespace boost {
18
19namespace posix_time {
20
21  //! Creates a time_duration object from a delimited string
22  /*! Expected format for string is "[-]h[h][:mm][:ss][.fff]".
23   * A negative duration will be created if the first character in
24   * string is a '-', all other '-' will be treated as delimiters.
25   * Accepted delimiters are "-:,.". */
26  inline time_duration duration_from_string(const std::string& s) {
27    return date_time::parse_delimited_time_duration<time_duration>(s);
28  }
29
30  inline ptime time_from_string(const std::string& s) {
31    return date_time::parse_delimited_time<ptime>(s, ' ');
32  }
33
34  inline ptime from_iso_string(const std::string& s) {
35    return date_time::parse_iso_time<ptime>(s, 'T');
36  }
37
38
39
40} } //namespace posix_time
41
42
43#endif
44
Note: See TracBrowser for help on using the repository browser.