FAQ Database Discussion Community

Producing UNIX timestamp out of datetime passed in C

I'm porting a C app from Solaris to RedHat, and this function does not work very well on RedHat (and I need your help determing why): int toTimestamp (const char *InputDate, const char *DateFormat, time_t *lTimestamp){ struct tm tm; if (NULL == strptime(InputDate, DateFormat, &tm)){ return FALSE; } *lTimestamp =...

Convert double to time_t

I have a double containing seconds. I would like to convert this into a time_t. I can't find a standard function which accomplishes this. Do I have to fill out the time_t by hand?...