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
The following implementation of timegm(1) works swimmingly on Android, and probably works on other Unix variants as well:
timegm(1)
time_t timegm( struct tm *tm ) { time_t t = mktime( tm ); return t + localtime( &t )->tm_gmtoff; }