u8 mf_stat(u8* path)
{
u8 res,yue,date,hour,minute,sec;
u16 year;
char str[30];
FILINFO* fno1;
res=f_stat ((const TCHAR*)path,fno1);
if (res != FR_OK)
{
printf("%d \r\n获取时间失败",res);
}
else
{
year=((*fno1).fdate>>9)+1980;
yue=(((*fno1).fdate)>>5)&0x0f;
date=((*fno1).fdate)&0x1f;
hour=((*fno1).ftime)>>11;
minute=((*fno1).ftime)>>5&0x3f;
sec=(((*fno1).ftime)>>11&0x1f)*2;是这个思路写的吧
sprintf(str,"%d %d %d",year,yue,date);
LCD_ShowString(0,180,480,72,24,(u8*)str);
sprintf(str,"%dh %dm %ds",hour,minute,sec);
LCD_ShowString(0,210,480,72,24,(u8*)str);
printf("\r\n%d年 %d月 %d日",year,yue,date);
printf("\r\n%d时 %d分 %d秒\r\n",hour,minute,sec);
}
return res;
}
|