| iMatix home page | << | < | > | >> |
SFL Version 2.11 |
#include "sfldate.h" void future_date (long *date, long *time, long days, long csecs)
Calculates a future date and time from the date and time specified, plus an interval specified in days and 1/100th seconds. The date can be any date since some distant epoch (around 1600). If the date and time arguments are both zero, the current date and time are used. Either date and time arguments may be null.
{ long dummy_date = 0, dummy_time = 0; if (date == NULL) date = &dummy_date; if (time == NULL) time = &dummy_time; /* Set date and time to NOW if necessary */ if (*date == 0 && *time == 0) { *date = date now (); *time = time now (); } /* Get future date in days and centiseconds */ days = date to days (*date) + days; csecs = time to csecs (*time) + csecs; /* Normalise overflow in centiseconds */ while (csecs >= INTERVAL_DAY) { days++; csecs -= INTERVAL_DAY; } /* Convert date and time back into organised values */ *date = days to date (days); *time = csecs to time (csecs); }
| << | < | > | >> | Copyright © 1996-2000 iMatix Corporation |