MCPcopy Create free account
hub / github.com/Rblp/Rblpapi / bbgDatetimeToUTC

Function bbgDatetimeToUTC

src/blpapi_utils.cpp:123–136  ·  view source on GitHub ↗

In case data already comes in localtime (cf TZDF ) we need to adjust back to UTC

Source from the content-addressed store, hash-verified

121// In case data already comes in localtime (cf TZDF<GO>)
122// we need to adjust back to UTC
123const 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
138void addPosixClass(SEXP x) {
139 // create and add dates class to dates object

Callers 2

processMessageFunction · 0.85
processMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected