| 507 | RTM_EXPORT(gettimeofday); |
| 508 | |
| 509 | int settimeofday(const struct timeval *tv, const struct timezone *tz) |
| 510 | { |
| 511 | /* The use of the timezone structure is obsolete; |
| 512 | * the tz argument should normally be specified as NULL. |
| 513 | * The tz_dsttime field has never been used under Linux. |
| 514 | * Thus, the following is purely of historic interest. |
| 515 | */ |
| 516 | #ifdef RT_USING_RTC |
| 517 | if (tv != RT_NULL && (long)tv->tv_usec >= 0 && (long)tv->tv_sec >= 0) |
| 518 | { |
| 519 | if (_control_rtc(RT_DEVICE_CTRL_RTC_SET_TIMEVAL, (void *)tv) == RT_EOK) |
| 520 | { |
| 521 | return 0; |
| 522 | } |
| 523 | else |
| 524 | { |
| 525 | if (_control_rtc(RT_DEVICE_CTRL_RTC_SET_TIME, (void *)&tv->tv_sec) == RT_EOK) |
| 526 | { |
| 527 | return 0; |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | #endif /* RT_USING_RTC */ |
| 532 | |
| 533 | rt_set_errno(EINVAL); |
| 534 | return -1; |
| 535 | } |
| 536 | RTM_EXPORT(settimeofday); |
| 537 | |
| 538 | #if defined(RT_USING_POSIX_DELAY) && defined(RT_USING_KTIME) |
nothing calls this directly
no test coverage detected