localtime vs localtime_s and appropriate input arguments

后端 未结 3 585
轻奢々
轻奢々 2020-12-02 17:02
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );

This returns: warning C4996: \'localtime\': Thi

3条回答
  •  无人及你
    2020-12-02 17:10

    localtime_s is just a microsoft implementation of the localtime functon, you can safely keep using locatime becaue it's C++ ISO compliant and ony microsoft marked it as "deprecated". The localtime function itself isn't deprecated at all in the C++ world.

    The localtime_s reference says that these parameters should be passed to it:

    _tm 
    Pointer to the time structure to be filled in.
     time 
    Pointer to the stored time.
    

提交回复
热议问题