|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sfldate.h" time_t date_to_timer (long date, long time)
Converts the supplied date and time into a time_t timer value. This is the number of non-leap seconds since 00:00:00 GMT Jan 1, 1970. Function was rewritten by Bruce Walter walter@fortean.com. If the input date and time are invalid, returns 0.
{
struct tm
time_struct;
time_t
timer;
time_struct.tm_sec = GET_SECOND (time);
time_struct.tm_min = GET_MINUTE (time);
time_struct.tm_hour = GET_HOUR (time);
time_struct.tm_mday = GET_DAY (date);
time_struct.tm_mon = GET_MONTH (date) - 1;
time_struct.tm_year = GET_CCYEAR (date) - 1900;
time_struct.tm_isdst = -1;
timer = mktime (&time_struct);
if (timer == -1)
return (0);
else
return (timer);
}
| | << | < | > | >> |
|