Changeset 60af6fc2 in mainline
- Timestamp:
- 2012-08-20T21:38:24Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c9abf50
- Parents:
- 6f445a67
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
r6f445a67 r60af6fc2 71 71 /** true if device is removed */ 72 72 bool removed; 73 /** time at which the system booted */ 74 time_t boottime; 73 75 } rtc_t; 74 76 … … 94 96 95 97 static ddf_dev_ops_t rtc_dev_ops; 96 static time_t boottime = 0;97 98 98 99 /** The RTC device driver's standard operations */ … … 298 299 rtc_t *rtc = fun_rtc(fun); 299 300 300 if (boottime != 0) { 301 fibril_mutex_lock(&rtc->mutex); 302 303 if (rtc->boottime != 0) { 301 304 /* There is no need to read the current time from the 302 305 * device because it has already been cached. 303 306 */ 304 307 305 time_t cur_time = boottime + uptime_get(); 308 time_t cur_time = rtc->boottime + uptime_get(); 309 310 fibril_mutex_unlock(&rtc->mutex); 311 306 312 return localtime2tm(cur_time, t); 307 313 } … … 372 378 } 373 379 374 fibril_mutex_unlock(&rtc->mutex);375 376 380 /* Try to normalize the content of the tm structure */ 377 381 time_t r = mktime(t); 378 382 379 boottime = r - uptime_get(); 383 rtc->boottime = r - uptime_get(); 384 385 fibril_mutex_unlock(&rtc->mutex); 380 386 381 387 return r < 0 ? EINVAL : EOK; … … 410 416 } 411 417 418 fibril_mutex_lock(&rtc->mutex); 419 412 420 /* boottime must be recomputed */ 413 boottime = 0; 414 415 fibril_mutex_lock(&rtc->mutex); 421 rtc->boottime = 0; 416 422 417 423 /* Detect the RTC epoch */
Note:
See TracChangeset
for help on using the changeset viewer.