FAQ Database Discussion Community


Convert double to time_t

c++,time,standards,chrono,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?...

Producing UNIX timestamp out of datetime passed in C

c,datetime,timestamp,redhat,time-t
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 =...