#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);

相关文章:

  • 2022-01-17
  • 2021-10-20
  • 2022-03-02
  • 2021-06-06
  • 2022-01-23
  • 2022-01-14
  • 2022-02-10
  • 2022-02-10
猜你喜欢
  • 2022-02-08
  • 2022-12-23
  • 2021-04-20
  • 2022-02-14
相关资源
相似解决方案