Converting Between Local Times and GMT/UTC in C/C++
You’re supposed to use combinations of gmtime/localtime and timegm/mktime. That should give you the orthogonal tools to do conversions between struct tm and time_t. For UTC/GMT: time_t t; struct tm tm; struct tm * tmp; … t = timegm(&tm); … tmp = gmtime(t); For localtime: t = mktime(&tm); … tmp = localtime(t); All tzset() does … Read more