fw4spl
dateAndTime.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWTOOLS_DATEANDTIME_HPP__
8 #define __FWTOOLS_DATEANDTIME_HPP__
9 
10 
11 #include <boost/date_time/posix_time/posix_time.hpp>
12 
13 #include "fwTools/config.hpp"
14 
15 namespace fwTools
16 {
17 
23 //------------------------------------------------------------------------------
29 FWTOOLS_API ::boost::gregorian::date strToBoostDate( const std::string &dateStr );
30 
31 //------------------------------------------------------------------------------
32 
38 FWTOOLS_API ::boost::posix_time::time_duration strToBoostTime( const std::string &timeStr );
39 
40 //------------------------------------------------------------------------------
41 
48 FWTOOLS_API ::boost::posix_time::ptime strToBoostDateAndTime( const std::string &dateStr,
49  const std::string &timeStr = "000000");
50 
51 //------------------------------------------------------------------------------
52 
58 FWTOOLS_API std::string getDate( const ::boost::posix_time::ptime &dateAndTime );
59 
60 //------------------------------------------------------------------------------
61 
62 // HHMMSS
68 FWTOOLS_API std::string getTime ( const ::boost::posix_time::ptime & dateAndTime );
69 
70 //------------------------------------------------------------------------------
71 
76 FWTOOLS_API std::string getCurrentTime();
77 
79 }
80 
81 #endif // __FWTOOLS_DATEANDTIME_HPP__
The namespace fwTools contains several tools like UUID, factory, dispatche, stringizer, macros, helper.
FWTOOLS_API std::string getCurrentTime()
Return the current clock.
FWTOOLS_API::boost::gregorian::date strToBoostDate(const std::string &dateStr)
Convert a string date to a boost date.
Definition: dateAndTime.cpp:19
FWTOOLS_API::boost::posix_time::time_duration strToBoostTime(const std::string &timeStr)
Convert a string time to a boost time.
Definition: dateAndTime.cpp:53
FWTOOLS_API std::string getDate(const ::boost::posix_time::ptime &dateAndTime)
Convert a boost time to a string date.
FWTOOLS_API std::string getTime(const ::boost::posix_time::ptime &dateAndTime)
Convert a boost time to a string time.
FWTOOLS_API::boost::posix_time::ptime strToBoostDateAndTime(const std::string &dateStr, const std::string &timeStr="000000")
Convert string data time to a boost time.
Definition: dateAndTime.cpp:94