Lines Matching refs:tv

82 STATIC INLINE BOOL ValidTimeval(const struct timeval *tv)
85 if (tv == NULL) {
90 if ((tv->tv_usec < 0) || (tv->tv_usec >= OS_SYS_US_PER_SECOND) || (tv->tv_sec < 0)) {
97 STATIC INLINE BOOL ValidTimeval64(const struct timeval64 *tv)
100 if (tv == NULL) {
105 if ((tv->tv_usec < 0) || (tv->tv_usec >= OS_SYS_US_PER_SECOND) || (tv->tv_sec < 0)) {
285 STATIC INT32 OsSetTimeOfDay(const struct timeval64 *tv, const struct timezone *tz)
301 setTime.tv_sec = tv->tv_sec;
302 setTime.tv_nsec = tv->tv_usec * OS_SYS_NS_PER_US;
320 int settimeofday(const struct timeval *tv, const struct timezone *tz)
324 if (!ValidTimeval(tv)) {
328 stTimeVal64.tv_sec = tv->tv_sec;
329 stTimeVal64.tv_usec = tv->tv_usec;
335 int settimeofday64(const struct timeval64 *tv, const struct timezone *tz)
337 if (!ValidTimeval64(tv)) {
341 return OsSetTimeOfDay(tv, tz);
347 struct timeval tv = {0};
349 tv.tv_sec = seconds;
350 tv.tv_usec = 0;
352 return settimeofday(&tv, NULL);
355 STATIC INT32 OsGetTimeOfDay(struct timeval64 *tv, struct timezone *tz)
370 tv->tv_sec = realTime.tv_sec;
371 tv->tv_usec = realTime.tv_nsec / OS_SYS_NS_PER_US;
373 if (tv->tv_sec < 0) {
380 int gettimeofday64(struct timeval64 *tv, struct timezone *tz)
382 if (tv == NULL) {
386 return OsGetTimeOfDay(tv, tz);
391 int gettimeofday(struct timeval *tv, void *_tz)
393 int gettimeofday(struct timeval *tv, struct timezone *tz)
401 if (tv == NULL) {
410 tv->tv_sec = stTimeVal64.tv_sec;
411 tv->tv_usec = stTimeVal64.tv_usec;
416 tv->tv_sec = (time_t)stTimeVal64.tv_sec;
417 tv->tv_usec = (suseconds_t)stTimeVal64.tv_usec;
425 struct timeval tv = {0};
456 tv.tv_sec = tp->tv_sec;
457 tv.tv_usec = tp->tv_nsec / OS_SYS_NS_PER_US;
458 return settimeofday(&tv, NULL);