Skip to content

Commit

Permalink
3avirt: Fix RTC time calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyGoat committed Oct 26, 2023
1 parent c71741b commit 88a9ee1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Targets/Bonito3avirt/Bonito/tgt_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,13 +575,15 @@ void cfg_coherent(int ac, char *av[])

time_t tgt_gettime()
{
return RTC_TIME_LOW | RTC_TIME_HIGH << 32;
u64 rtc_ns = RTC_TIME_LOW | RTC_TIME_HIGH << 32;
return rtc_ns / 1000000000;
}

void tgt_settime(time_t t)
{
RTC_TIME_HIGH = t >> 32;
RTC_TIME_LOW = t & 0xffffffff;
u64 rtc_ns = t * 1000000000;
RTC_TIME_HIGH = rtc_ns >> 32;
RTC_TIME_LOW = rtc_ns & 0xffffffff;
}


Expand Down Expand Up @@ -1401,4 +1403,4 @@ void board_info_fixup(struct efi_cpuinfo_loongson * c)
for (i = 0; i < nr_cpus; i++) {
c->reserved_cores_mask &= ~(1 << i);
}
}
}

0 comments on commit 88a9ee1

Please sign in to comment.