I have this chunk of code used to get local time instance.
#include <sys/time.h>
#include <cstdio>
#include <ctime>
#include <cstdlib>
std::time_t rawtime;
std::tm* timeinfo;
char buffer [80];
std::time(&rawtime);
timeinfo = std::localtime(&rawtime);
std::strftime(buffer, 80, "%d%m%Y_%H%M_bishan_", timeinfo);
Current local time is 02/02/2024 Morning 11:51AM But the time instance produced by the code is 02022024_2351_bishan_. How can I change to be 02022024_1151_bishan_3?
Why are you still using the "C" api. For anything regarding time in C++ use the
<chrono>header. This really avoids problems with type safety, buffer issues (security) etc.