unixtodo.c
来自「vc library 韩国语版 希望对大家又帮助」· C语言 代码 · 共 31 行
C
31 行
#include <stdio.h>
#include <dos.h>
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;
void main(void)
{
unsigned long val;
/* get today's date and time */
getdate(&dt);
gettime(&tm);
printf("today is %d %s %d\n",
dt.da_day, month[dt.da_mon], dt.da_year);
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);
printf("42 days ago it was %d %s %d\n",
dt.da_day, month[dt.da_mon], dt.da_year);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?