Easy way to convert a struct tm (expressed in UTC) to time_t type

前端 未结 9 923
臣服心动
臣服心动 2020-11-29 05:44

How do I do the above? There is mktime function but that treats the input as expressed in local time but how do i perform the conversion if my input tm variable happens to b

9条回答
  •  离开以前
    2020-11-29 06:27

    for those on windows, the below function is available:

    _mkgmtime
    

    link for more info: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mkgmtime-mkgmtime32-mkgmtime64

提交回复
热议问题