Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const std::string currentDateTime() {
- time_t currentTime;
- struct tm *localTime;
- time( ¤tTime ); // Get the current time
- localTime = localtime( ¤tTime ); // Convert the current time to the local time
- int Day = localTime->tm_mday;
- int Month = localTime->tm_mon + 1;
- int Year = localTime->tm_year + 1900;
- int Hour = localTime->tm_hour;
- int Min = localTime->tm_min;
- int Sec = localTime->tm_sec;
- char timeBuf[512];
- str_format(timeBuf, sizeof(timeBuf), "%d:%d:%d %d.%d.%d", Hour, Min, Sec, Day, Month, Year);
- return timeBuf;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement