Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions [C++] Overwatch Aim Assistance/Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,24 @@ double Time::timerStop()
string Time::getDate(char delimiter)
{
time_t t = time(0); //now
struct tm *now = localtime(&t);
struct tm now;
localtime_s(&now, &t);//error C4996 fix

ostringstream ss; //use iss or oss and NOT ss (bulkier)
ss << now->tm_mday << delimiter << (now->tm_mon + 1)
<< delimiter << (now->tm_year + 1900);
ss << now.tm_mday << delimiter << (now.tm_mon + 1)
<< delimiter << (now.tm_year + 1900);

return ss.str();
}

string Time::getTime(char delimiter)
{
time_t t = time(0);
struct tm *now = localtime(&t);
struct tm now;
localtime_s(&now, &t);//error C4996 fix

ostringstream ss;
ss << now->tm_hour << delimiter << now->tm_min << delimiter << now->tm_sec;
ss << now.tm_hour << delimiter << now.tm_min << delimiter << now.tm_sec;

return ss.str();
}
}