Changes in uspace/drv/time/cmos-rtc/cmos-rtc.c [205f1add:05882233] in mainline
- File:
-
- 1 edited
-
uspace/drv/time/cmos-rtc/cmos-rtc.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
r205f1add r05882233 75 75 int clients_connected; 76 76 /** time at which the system booted */ 77 struct time specboot_time;77 struct timeval boot_time; 78 78 } rtc_t; 79 79 … … 204 204 205 205 rtc->boot_time.tv_sec = 0; 206 rtc->boot_time.tv_ nsec = 0;206 rtc->boot_time.tv_usec = 0; 207 207 rtc->clients_connected = 0; 208 208 … … 331 331 */ 332 332 333 struct time speccurtime;333 struct timeval curtime; 334 334 335 335 getuptime(&curtime); 336 t s_add(&curtime, &rtc->boot_time);336 tv_add(&curtime, &rtc->boot_time); 337 337 fibril_mutex_unlock(&rtc->mutex); 338 338 339 return time_t s2tm(&curtime, t);339 return time_tv2tm(&curtime, t); 340 340 } 341 341 … … 346 346 } 347 347 348 /* Nanoseconds are below RTC's resolution, assume 0. */349 t->tm_ nsec = 0;348 /* Microseconds are below RTC's resolution, assume 0. */ 349 t->tm_usec = 0; 350 350 351 351 /* now read the registers */ … … 419 419 result = EINVAL; 420 420 else { 421 struct time specuptime;421 struct timeval uptime; 422 422 423 423 getuptime(&uptime); 424 424 rtc->boot_time.tv_sec = r; 425 rtc->boot_time.tv_ nsec = t->tm_nsec; /* normalized */426 t s_sub(&rtc->boot_time, &uptime);425 rtc->boot_time.tv_usec = t->tm_usec; /* normalized */ 426 tv_sub(&rtc->boot_time, &uptime); 427 427 result = EOK; 428 428 } … … 445 445 bool bcd_mode; 446 446 time_t norm_time; 447 struct time specuptime;448 struct time specntv;447 struct timeval uptime; 448 struct timeval ntv; 449 449 int reg_b; 450 450 int reg_a; … … 457 457 458 458 ntv.tv_sec = norm_time; 459 ntv.tv_ nsec = t->tm_nsec;459 ntv.tv_usec = t->tm_usec; 460 460 getuptime(&uptime); 461 461 462 if (t s_gteq(&uptime, &ntv)) {462 if (tv_gteq(&uptime, &ntv)) { 463 463 /* This is not acceptable */ 464 464 return EINVAL; … … 474 474 /* boot_time must be recomputed */ 475 475 rtc->boot_time.tv_sec = 0; 476 rtc->boot_time.tv_ nsec = 0;476 rtc->boot_time.tv_usec = 0; 477 477 478 478 /* Detect the RTC epoch */
Note:
See TracChangeset
for help on using the changeset viewer.
