Changeset 231b3fd in mainline for uspace/drv/time/cmos-rtc/cmos-rtc.c
- Timestamp:
- 2018-08-25T21:35:26Z (6 years ago)
- Parents:
- e2625b1a (diff), 3c45353 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Jakub Jermář <jakub@…> (2018-08-25 21:35:26)
- git-committer:
- GitHub <noreply@…> (2018-08-25 21:35:26)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
re2625b1a r231b3fd 75 75 int clients_connected; 76 76 /** time at which the system booted */ 77 struct time valboot_time;77 struct timespec boot_time; 78 78 } rtc_t; 79 79 … … 204 204 205 205 rtc->boot_time.tv_sec = 0; 206 rtc->boot_time.tv_ usec = 0;206 rtc->boot_time.tv_nsec = 0; 207 207 rtc->clients_connected = 0; 208 208 … … 331 331 */ 332 332 333 struct time valcurtime;333 struct timespec curtime; 334 334 335 335 getuptime(&curtime); 336 t v_add(&curtime, &rtc->boot_time);336 ts_add(&curtime, &rtc->boot_time); 337 337 fibril_mutex_unlock(&rtc->mutex); 338 338 339 return time_t v2tm(&curtime, t);339 return time_ts2tm(&curtime, t); 340 340 } 341 341 … … 346 346 } 347 347 348 /* Microseconds are below RTC's resolution, assume 0. */349 t->tm_ usec = 0;348 /* Nanoseconds are below RTC's resolution, assume 0. */ 349 t->tm_nsec = 0; 350 350 351 351 /* now read the registers */ … … 419 419 result = EINVAL; 420 420 else { 421 struct time valuptime;421 struct timespec uptime; 422 422 423 423 getuptime(&uptime); 424 424 rtc->boot_time.tv_sec = r; 425 rtc->boot_time.tv_ usec = t->tm_usec; /* normalized */426 t v_sub(&rtc->boot_time, &uptime);425 rtc->boot_time.tv_nsec = t->tm_nsec; /* normalized */ 426 ts_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 valuptime;448 struct time valntv;447 struct timespec uptime; 448 struct timespec ntv; 449 449 int reg_b; 450 450 int reg_a; … … 457 457 458 458 ntv.tv_sec = norm_time; 459 ntv.tv_ usec = t->tm_usec;459 ntv.tv_nsec = t->tm_nsec; 460 460 getuptime(&uptime); 461 461 462 if (t v_gteq(&uptime, &ntv)) {462 if (ts_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_ usec = 0;476 rtc->boot_time.tv_nsec = 0; 477 477 478 478 /* Detect the RTC epoch */
Note:
See TracChangeset
for help on using the changeset viewer.