函数名: unixtodos
函数名: unixtodos
功 能: 把日期和时间转换成DOS格式
程序举例
#include
#include
char *month = {"---", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
#define SECONDS_PER_DAY 86400L
struct date dt;
struct time tm;
int main(void)
{
unsigned long val;
getdate(&dt);
gettime(&tm);
printf("today is %d %s %dn", dt.da_day, month, dt.da_year);
val = dostounix(&dt, &tm);
val -= (SECONDS_PER_DAY * 42);
unixtodos(val, &dt, &tm);
printf("42 days ago it was %d %s %dn",
dt.da_day, month, dt.da_year);
return 0;
}