vxworks获取系统时间编程
#include<time.h> //头文件
unsigned int timeLen;
struct timespec tp;
struct tm timeBuffer;
time_t nowSec;
char datetime[64];
/* prepare the time stamp */
(void)clock_gettime(CLOCK_REALTIME, &tp);
nowSec = tp.tv_sec;
(void)gmtime_r(&nowSec, &timeBuffer);
timeLen = strftime(datetime, 64, "%y%m%d %H:%M:%S", &timeBuffer);
sprintf(datetime + timeLen, ".%3.3ld", tp.tv_nsec / 1000000L);
printf("datetime is :%s,now feed si-e watchdog!\n",datetime);