The seconds() method should call from main method and it should print the format of 00:00:00 January 1, 1901 GMT and it should returns(calculate) number of seconds elapsed till user input time, i am new to the C++, i tried a lot but not able to make it happen, Below is the code i tried, anyone please help
boost::posix_time::ptime timeObj = boost::posix_time::time_from_string("1901/01/01 00:00:00"); // here i tried to start the day from the mentioned date and time
boost::posix_time::ptime timeLocal = boost::posix_time::second_clock::local_time(); // Get current system time
boost::posix_time::time_duration durObj = timeLocal.time_of_day(); std::cout << "Seconds : = " << timeLocal.time_of_day().seconds() << std::endl;
after this
1) I need to get a difference of seconds from 00:00:00 January 1, 1901 GMT to user input time. 2) in front of it should returns the format of 00:00:00 January 1, 1901 GMT.
I am doing this because i am customizing this boost library for our own product use. please suggest me to do this.
Aucun commentaire:
Enregistrer un commentaire