fork(1) download
  1. #include <chrono>
  2. #include <cmath>
  3. #include <iomanip>
  4. #include <iostream>
  5. #include <sstream>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10. istringstream timestamp("28.08.2017 03:59:55.0007");
  11. tm tmb;
  12. double r;
  13.  
  14. timestamp >> get_time(&tmb, "%d.%m.%Y %T") >> r;
  15.  
  16. const auto output = chrono::time_point_cast<chrono::microseconds>(chrono::system_clock::from_time_t(mktime(&tmb))) + chrono::microseconds(lround(r * micro::den));
  17.  
  18. cout << output.time_since_epoch().count() << endl;
  19. }
Success #stdin #stdout 0s 4364KB
stdin
Standard input is empty
stdout
1503892795000700