gettimeofday_r.c
来自「FAT16 Filesystem on Philips LPC2000 seri」· C语言 代码 · 共 42 行
C
42 行
#include <reent.h>#include <errno.h>#include <devices.h>#include <sys/time.h>#include <types.h>#include <sysdefs.h>#include <sysdefs.h>#include <time.h>//// note: MSDOS epoch is: 315532800 -- Jan 01, 1980 00:00:00//// note: unix epoch is: 0 -- Jan 01, 1970 00:00:00///*********************************************************** * * gettimeofday_r * return time in epoch seconds since Jan 01, 1970 ************************************************************/int _gettimeofday_r (struct _reent *r, struct timeval *tp, struct timezone *tzp){struct tm now;#ifdef HAS_CLOCK readRTC (&now); // adjust for differences between our clock and a "normal" clock. now.tm_year -= 1900; now.tm_mon -= 1; now.tm_yday -= 1;#else { time_t newTime; newTime = 0; localtime_r(&newTime, &now); }#endif tp->tv_sec = mktime(&now); tp->tv_usec = 0; return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?