时钟代码,执行后出现"undefined reference to 'gettime' ",求各位大神指点
#include<stdio.h>#include<math.h>
#include<dos.h>
#include<conio.h>
#include<windows.h>
#include<sys/time.h>
int main()
{
struct time
{
unsigned char ti_min;
unsigned char ti_hour;
unsigned char ti_hund;
unsigned char ti_sec;
};
struct time curtime;
float th_hour,th_min,th_sec;
do
{
printf("****************************************\n");
printf("**This is a simple clock program **\n");
printf("** **\n");
printf("****************************************\n");
printf("The currenr time is:\n");
gettime(&curtime);
if((float)curtime.ti_hour<=12)
{
printf("AM");
if((float)curtime.ti_hour<10)
printf("0");
printf("%.0f:",(float)curtime.ti_hour);
}
else
{
printf("PM");
if((float)curtime.ti_hour<10)
printf("0");
printf("%.0f:",(float)curtime.ti_hour);
}
if((float)curtime.ti_min<10)
printf("0");
printf("%.0f:",(float)curtime.ti_min);
if((float)curtime.ti_sec<10)
printf("0");
printf("%.0f:",(float)curtime.ti_sec);
Sleep(1000);
system ("cls");
}while (1);
}