summaryrefslogtreecommitdiff
path: root/p2pvr/lib/p2Helpers.cpp
blob: 0c1fe37b18811ee67121d3e4a69e0051d8c40f89 (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
#include <pch.hpp>
#include "p2Helpers.h"

template <>
VariableType &
operator<<<Common::DateTime>(VariableType & vt, const Common::DateTime & dt)
{
	vt = boost::posix_time::ptime(boost::gregorian::date(dt.Year, dt.Month, dt.Day),
			boost::posix_time::time_duration(dt.Hour, dt.Minute, 0));
	return vt;
}

template <>
VariableType &
operator>><Common::DateTime>(VariableType & vt, Common::DateTime & dt)
{
	const boost::posix_time::ptime & date = vt;
	dt.Year = date.date().year();
	dt.Month = date.date().month();
	dt.Day = date.date().day();
	dt.Hour = date.time_of_day().hours();
	dt.Minute = date.time_of_day().minutes();
	return vt;
}

template <>
VariableType &
operator>>(VariableType & vt, short int & v)
{
	v = (int)vt;
	return vt;
}