00001
00008 #include <reent.h>
00009
00010
00011 #include <sys/time.h>
00012
00013
00014 #include <time.h>
00015
00016
00017
00018
00019
00020
00021
00022
00023
00034 int _gettimeofday_r(struct _reent *r, struct timeval *tp, struct timezone *tzp)
00035 {
00036 struct tm now;
00037
00038 #ifdef HAS_CLOCK
00039
00040 readRTC(&now);
00041
00042 now.tm_year -= 1900;
00043 now.tm_mon -= 1;
00044 now.tm_yday -= 1;
00045
00046 #else
00047
00048 {
00049 time_t newTime;
00050 newTime = 0;
00051 localtime_r(&newTime,&now);
00052 }
00053
00054 #endif
00055
00056 tp->tv_sec = mktime(&now);
00057 tp->tv_usec = 0;
00058 return 0;
00059 }
00060