Skip to content
Snippets Groups Projects
Commit 80558035 authored by Jason Wu's avatar Jason Wu
Browse files

put back removed MJD_START calculation

parent e340bb11
No related branches found
No related tags found
No related merge requests found
Pipeline #122745 passed
......@@ -59,6 +59,17 @@ void EDDPolnMerge::init(RawBytes& block)
ascii_header_get(block.ptr(), "SYNC_TIME", "%s", buffer);
long double sync_time = std::strtold(buffer, NULL);
long double unix_time = sync_time + (sample_clock_start / sample_clock);
char time_buffer[80];
std::time_t unix_time_int;
struct std::tm * timeinfo;
double fractpart, intpart;
fractpart = std::modf (static_cast<double>(unix_time) , &intpart);
unix_time_int = static_cast<std::time_t>(intpart);
timeinfo = std::gmtime (&unix_time_int);
std::strftime(time_buffer, 80, "%Y-%m-%d-%H:%M:%S", timeinfo);
std::stringstream utc_time_stamp;
utc_time_stamp << time_buffer << "." << std::setw(10) << std::setfill('0') << std::size_t(fractpart * 10000000000) << std::setfill(' ');
ascii_header_set(oblock.ptr(), "UTC_START", "%s", utc_time_stamp.str().c_str());
long double mjd_time = (unix_time / 86400.0 ) + 40587;
std::ostringstream mjd_start;
mjd_start << std::fixed;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment