C++: how to get the actual time with time and localtime?

后端 未结 4 741
暖寄归人
暖寄归人 2021-02-19 03:41

I\'m looking for a way to save the time in a HH::MM::SS fashion in C++. I saw here that they are many solutions and after a little research I opted for time and

4条回答
  •  甜味超标
    2021-02-19 04:00

    If you are worried about reentrancy in localtime and gmtime, there is localtime_r and gmtime_r which can handle multiple calls.

    When it comes to formatting the time to your liking, check the function strftime.

提交回复
热议问题