I tried to print the current time in the usual format of hh:mm:ss however I get the full date format instead. I need the answer to be in string or int, so it is easier to deal with. I was thinking of adding it to a log file so that I can make it easier to track my program.
#include <iostream>
#include <chrono>
#include <ctime>
int main()
{
auto curr_time = std::chrono::system_clock::now();
std::time_t pcurr_time = std::chrono::system_clock::to_time_t(curr_time);
std::cout << "current time" << std::ctime(&pcurr_time)<<"\n";
}
I do want a little tip to help me do so.