summaryrefslogtreecommitdiff
path: root/p2pvr/ice/commonHelpers.h
blob: cc3cac1b653aa62f22f3ceebc1b40ad9587e96a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef ICE_COMMON_HELPERS_H
#define ICE_COMMON_HELPERS_H

#include <common.h>
#include <ostream>
#include <iomanip>
#include <boost/date_time/posix_time/posix_time_types.hpp>

namespace Common {
	template<typename C, typename T>
	std::basic_ostream<C, T> &
	operator<<(std::basic_ostream<C, T> & o, const Common::DateTime & dt)
	{
		o << std::setw(4) << std::setfill('0') << dt.Year
			<< "-" << std::setw(2) << std::setfill('0') << dt.Month
			<< "-" << std::setw(2) << std::setfill('0') << dt.Day
			<< "T" << std::setw(2) << std::setfill('0') << dt.Hour
			<< ":" << std::setw(2) << std::setfill('0') << dt.Minute;
		return o;
	}
	boost::posix_time::ptime operator*(const Common::DateTime &);
	boost::posix_time::time_duration operator*(const Common::Duration &);
}
namespace boost {
	namespace posix_time {
		Common::DateTime operator*(const boost::posix_time::ptime &);
		Common::Duration operator*(const boost::posix_time::time_duration &);
	}
}

#endif