#define MSEC_TICKS_PER_SECOND 1000
boost::local_time::local_date_time ConvertTimeZone(
const std::tm &from_tm,
const int16_t &from_milliseconds,
const boost::local_time::time_zone_ptr &from_tz,
const boost::local_time::time_zone_ptr &to_tz) {
using boost::gregorian::date;
using boost::posix_time::time_duration;
using boost::local_time::local_date_time;
local_date_time from_ldt(
date(from_tm.tm_year + 1900,
from_tm.tm_mon + 1,
from_tm.tm_mday),
time_duration(from_tm.tm_hour,
from_tm.tm_min,
from_tm.tm_sec,
time_duration::ticks_per_second() / MSEC_TICKS_PER_SECOND *
from_milliseconds),
from_tz,
boost::local_time::local_date_time::NOT_DATE_TIME_ON_ERROR);
return from_ldt.local_time_in(to_tz);
}
#undef MSEC_TICKS_PER_SECOND