In case data already comes in localtime (cf TZDF ) we need to adjust back to UTC
| 121 | // In case data already comes in localtime (cf TZDF<GO>) |
| 122 | // we need to adjust back to UTC |
| 123 | const double bbgDatetimeToUTC(const BloombergLP::blpapi::Datetime& dt) { |
| 124 | boost::gregorian::date bbg_boost_date(dt.year(),dt.month(),dt.day()); |
| 125 | boost::posix_time::time_duration td = |
| 126 | boost::posix_time::hours(dt.hours()) + |
| 127 | boost::posix_time::minutes(dt.minutes()) + |
| 128 | boost::posix_time::seconds(dt.seconds()) + |
| 129 | boost::posix_time::milliseconds(dt.milliseconds()); |
| 130 | boost::posix_time::ptime bbg_ptime(bbg_boost_date,td); |
| 131 | |
| 132 | // cf http://stackoverflow.com/a/4462309/143305 |
| 133 | boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1)); |
| 134 | boost::posix_time::time_duration::sec_type x = (bbg_ptime - epoch).total_seconds(); |
| 135 | return x; |
| 136 | } |
| 137 | |
| 138 | void addPosixClass(SEXP x) { |
| 139 | // create and add dates class to dates object |
no outgoing calls
no test coverage detected