mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-21 18:33:23 +00:00
使用rust重构softirq机制;解决Rtc驱动的编译警告问题 (#138)
* 使用rust重构softirq机制 * 解决Rtc驱动的编译警告问题 Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::driver::timers::rtc::rtc::{rtc_get_cmos_time, rtc_time_t};
|
||||
use crate::driver::timers::rtc::rtc::RtcTime;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type ktime_t = i64;
|
||||
@ -15,17 +15,15 @@ fn ktime_to_ns(kt: ktime_t) -> i64 {
|
||||
/// 时间戳为从UTC+0 1970-01-01 00:00到当前UTC+0时间,所经过的纳秒数。
|
||||
/// 注意,由于当前未引入时区,因此本函数默认时区为UTC+8来计算
|
||||
fn ktime_get_real() -> ktime_t {
|
||||
let mut rtc_time: rtc_time_t = rtc_time_t {
|
||||
second: (0),
|
||||
minute: (0),
|
||||
hour: (0),
|
||||
day: (0),
|
||||
month: (0),
|
||||
year: (0),
|
||||
};
|
||||
let mut rtc_time: RtcTime = RtcTime::default();
|
||||
|
||||
//调用rtc.h里面的函数
|
||||
rtc_get_cmos_time(&mut rtc_time);
|
||||
{
|
||||
let r = rtc_time.get();
|
||||
// 返回错误码
|
||||
if r.is_err() {
|
||||
return r.unwrap_err() as ktime_t;
|
||||
}
|
||||
}
|
||||
|
||||
let mut day_count: i32 = 0;
|
||||
for year in 1970..rtc_time.year {
|
||||
|
Reference in New Issue
Block a user