#include <stdio.h>
#include <sys/timeb.h>
#include <time.h>
void main( void )
{
struct _timeb timebuffer;
char *timeline;
_ftime( &timebuffer );
timeline = ctime( & ( timebuffer.time ) );
printf( "The time is %.19s.%hu %s", timeline, timebuffer.millitm, &timeline[20] );
}
本文展示了一个使用C语言获取当前系统时间的例子,通过调用_timeb和ctime函数,能够精确到毫秒级显示时间。

1万+

被折叠的 条评论
为什么被折叠?



