更新时间:2024-02-02 23:11
函数名: unixtodos
程序举例
#include
#include
#define SECONDS_PER_DAY 86400L /* the number of seconds in one day */
struct date dt;
struct time tm;
int main(void)
{
unsigned long val;
/* get today's date and time */
getdate(&dt);
gettime(&tm);
/* convert date and time to unix format (number of seconds since Jan 1, 1970) */
val = dostounix(&dt, &tm);
/* subtract 42 days worth of seconds */
val -= (SECONDS_PER_DAY * 42);
/* convert back to dos time and date */
unixtodos(val, &dt, &tm);
return 0;
}