I am trying to use a time_t from the past, and a new time, and using gmtime, make them both a structure to which I can change the new time to the same day of the week, after this I wish to make the new changed time back into a time_t and return it.
So my issues are, as a new programmer, I wish to know if the below code the right way to go about it, and if so, why do I get a:
""Error 3 error C4996: 'gmtime': This function or variable may be unsafe. Consider using gmtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." Error?
Code:
time_t copyStartTime(time_t &startTime,time_t eventTime ) //finds exact time of startTime and returns it
{
cout << eventTime << "\n";
cout << startTime << "\n";
cin.get();
tm* then = gmtime(&startTime);
cout << (then->tm_hour);
tm* now = gmtime(&eventTime);
cout << (now->tm_hour);
cin.get();
then->tm_hour = now->tm_hour;
time_t newTime = _mkgmtime(then);
cout << newTime << "\n";
cin.get();
return newTime;
}