time_t rawtime;
struct tm * timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
heure_= timeinfo->tm_hour;
minute_ = timeinfo->tm_min;
seconde_ = timeinfo->tm_sec;
jourMois_ = timeinfo->tm_mday;
jourSemaine_ = timeinfo->tm_wday;
mois_ = timeinfo->tm_mon;
annee_ = timeinfo->tm_year;
This is my implementation for a function that look up the time, the date,.... and so on.
I don`t know why but I get the error:
1>c:\users\sebastien\blabla: warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1> DateHeure.cpp
1>c:\users\sebastien\blabla-> error C4996: 'localtime': This function or variable may be unsafe. Consider using localtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio
12.0\vc\include\time.inl(112) : see declaration of 'localtime'
I have tried to change localtime to localtime_s but I get some error message concerning compatibility with parameter of type "tm".
I have also tried to (include or wright) __CRT_SECURE_NO_WARNINGS but with no success -> I don't know but just including this line seems odd (in the properties>c++>preprocessor>undefined preprocessor definitions) without adding anything else.
Acknowledge that I am not that familiar with Visual Studio, so I am not sure with all these properties setting and tweaking.
but I would really appreciate if one could help me with this time thing, I think it's my only error, I'll debug after to be sure.
Please include some information on the why... I'd like to understand.