c++ clock_gettime() and daylight savings

前端 未结 4 1643
终归单人心
终归单人心 2021-01-23 02:07

I am using clock_gettime() in my C++ program to get the current time. However, the return value is seconds since epoch in UTC. This code can get messed up in my time zone durin

4条回答
  •  粉色の甜心
    2021-01-23 02:18

    If you are able to use Boost, you can control all of this explicitly by using the date time libraries: http://www.boost.org/doc/libs/1_49_0/doc/html/date_time.html

    I've had to deal with time on a variety of platforms and in a variety of languages, and I find the boost libraries wildly superior to anything else available.

提交回复
热议问题