#include <stdio.h>
#include <time.h>// 可以测试ARM板的RTC是不是好的
void GetLocalTime(void)
{time_t now;struct tm *timenow;time(&now);timenow = localtime(&now);printf("Local time is = %s", asctime(timenow));
}int main(void)
{GetLocalTime();return 0;
}
root@libang-virtual-machine:~/test/test# gcc local_time.c root@libang-virtual-machine:~/test/test# ./a.out
Local time is = Tue Aug 23 14:53:16 2016