This is a public function that is responsible for defining "real-time". This function uses the CMOS of the system to calculate the time.
()
| 16 | // This is a public function that is responsible for defining "real-time". This function uses the CMOS of the |
| 17 | // system to calculate the time. |
| 18 | pub fn realtime() -> f64 |
| 19 | { |
| 20 | let rtc = CMOS::new().rtc(); |
| 21 | let timestamp = 86400 * d_before_yr(rtc.year as u64) |
| 22 | + 86400 * d_before_mon(rtc.year as u64, rtc.month as u64) |
| 23 | + 86400 * (rtc.day - 1) as u64 |
| 24 | + 3600 * rtc.hour as u64 |
| 25 | + 60 * rtc.minute as u64 |
| 26 | + rtc.second as u64; |
| 27 | let fract = time::time_between_ticks() * (time::tick() - time::last_rtcupdate()) as f64; |
| 28 | (timestamp as f64) + fract |
| 29 | } |
| 30 | |
| 31 | |
| 32 | // This is a public function that provides a method for returning the time that the system has been |
no test coverage detected