std::mktime and timezone info

后端 未结 12 544
忘了有多久
忘了有多久 2020-11-30 10:56

I\'m trying to convert a time info I reveive as a UTC string to a timestamp using std::mktime in C++. My problem is that in / &

12条回答
  •  爱一瞬间的悲伤
    2020-11-30 11:17

    mktime assumes that the date value is in the local time zone. Thus you can change the timezone environment variable beforehand (setenv) and get the UTC timezone.

    Windows tzset

    Can also try looking at various home-made utc-mktimes, mktime-utcs, etc.

提交回复
热议问题