* @brief Retrieves the current time and timezone information. * * This system call retrieves the current time in seconds and microseconds since * the Unix epoch (1970-01-01 00:00:00 UTC) and stores it in the `tp` argument. * It also retrieves the timezone information, if requested, and stores it in the * `tzp` argument. The time returned is the local time of the system unless * UTC is specif
| 1220 | * @see sys_time(), time(), gettimeofday() |
| 1221 | */ |
| 1222 | sysret_t sys_gettimeofday(struct timeval *tp, struct timezone *tzp) |
| 1223 | { |
| 1224 | #ifdef ARCH_MM_MMU |
| 1225 | struct timeval t_k; |
| 1226 | |
| 1227 | if (tp) |
| 1228 | { |
| 1229 | if (!lwp_user_accessable((void *)tp, sizeof *tp)) |
| 1230 | { |
| 1231 | return -EFAULT; |
| 1232 | } |
| 1233 | |
| 1234 | t_k.tv_sec = rt_tick_get() / RT_TICK_PER_SECOND; |
| 1235 | t_k.tv_usec = (rt_tick_get() % RT_TICK_PER_SECOND) * (1000000 / RT_TICK_PER_SECOND); |
| 1236 | |
| 1237 | lwp_put_to_user(tp, (void *)&t_k, sizeof t_k); |
| 1238 | } |
| 1239 | #else |
| 1240 | if (tp) |
| 1241 | { |
| 1242 | if (!lwp_user_accessable((void *)tp, sizeof *tp)) |
| 1243 | { |
| 1244 | return -EFAULT; |
| 1245 | } |
| 1246 | tp->tv_sec = rt_tick_get() / RT_TICK_PER_SECOND; |
| 1247 | tp->tv_usec = (rt_tick_get() % RT_TICK_PER_SECOND) * (1000000 / RT_TICK_PER_SECOND); |
| 1248 | } |
| 1249 | #endif |
| 1250 | |
| 1251 | return 0; |
| 1252 | } |
| 1253 | |
| 1254 | /** |
| 1255 | * @brief Sets the system's current time and timezone information. |
nothing calls this directly
no test coverage detected