Possible Duplicate:
Easy way to convert a struct tm (expressed in UTC) to time_t type
I am trying to convert a file path to UNIX time. The file path is of the format: "~/foo/bar/YYYYMMDD/HHMMSS.egg"
The time information contained within the path is already in UTC time. However, I can't find a way to convert UTC time to UNIX time, only to convert local time to UNIX time.
My relevant code is as follows:
struct tm * timeinfo;
time_t timeint;
time(&timeint);
timeinfo = gmtime(&timeint);
timeinfo->tm_year = year-1900;
timeinfo->tm_mon = month - 1;
...
timeint = mktime(timeinfo);
When I tried to validate this by checking the result at http://www.csgnetwork.com/unixds2timecalc.html, I found it was off by 4 hours, suggesting that it's actually inputting the time as if it were the time in EDT, not in UTC as it actually is. What do I have to do?