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

c++

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 be in UTC.

Best Solution

Use timegm() instead of mktime()