Biostime

biostime函式 用 法: long biostime(int cmd, long newtime) 功 能:計時器控制,cmd為功能號,為0時函式返回計時器的當前值,計時時間從午夜開始,以時鐘滴答聲為單位,每秒時鐘滴答18.2次;為1時將計時器設定為新值newtime。

程式例:

#include <stdio.h>

#include <bios.h>

#include <time.h>

#include <conio.h>

int main(void)

{

long bios_time;

clrscr();

cprintf("The number of clock ticks since midnight is:\r\n");

cprintf("The number of seconds since midnight is:\r\n");

cprintf("The number of minutes since midnight is:\r\n");

cprintf("The number of hours since midnight is:\r\n");

cprintf("\r\nPress any key to quit:");

while(!kbhit())

{

bios_time = biostime(0, 0L);

gotoxy(50, 1);

cprintf("%lu", bios_time);

gotoxy(50, 2);

cprintf("%.4f", bios_time / CLK_TCK);

gotoxy(50, 3);

cprintf("%.4f", bios_time / CLK_TCK / 60);

gotoxy(50, 4);

cprintf("%.4f", bios_time / CLK_TCK / 3600);

}

return 0;

}

相關詞條

相關搜尋

熱門詞條

聯絡我們