当前位置:首页 科普知识 unixtodos

unixtodos

发布时间:2023-09-14 00:57:16

函数名: unixtodos

unixtodos介绍

函数名: 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;

unixtodos

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);

unixtodos

printf("42 days ago it was %d %s %dn",

dt.da_day, month, dt.da_year);

return 0;

}

温馨提示:
本文【unixtodos】由作者 爱百科 转载提供。 该文观点仅代表作者本人, 自学教育网 信息发布平台,仅提供信息存储空间服务, 若存在侵权问题,请及时联系管理员或作者进行删除。
(c)2008-2025 自学教育网 All Rights Reserved 汕头市灵创科技有限公司
粤ICP备2024240640号-6