Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b893a0b

Browse files
author
Octavian Purdila
committed
lkl: initialize the time of day from host
Signed-off-by: Octavian Purdila <[email protected]>
1 parent 6b9bafd commit b893a0b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/lkl/kernel/time.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ static struct irqaction irq0 = {
105105
void __init time_init(void)
106106
{
107107
int ret;
108+
struct timespec ts;
109+
unsigned long long time;
108110

109111
if (!lkl_ops->timer_alloc || !lkl_ops->timer_free ||
110112
!lkl_ops->timer_set_oneshot || !lkl_ops->time) {
@@ -121,5 +123,10 @@ void __init time_init(void)
121123

122124
clockevents_config_and_register(&clockevent, HZ, 0, 0xffffffff);
123125

126+
time = lkl_ops->time();
127+
ts.tv_sec = time / NSEC_PER_SEC;
128+
ts.tv_nsec = time % NSEC_PER_SEC;
129+
do_settimeofday(&ts);
130+
124131
pr_info("lkl: time and timers initialized (irq%d)\n", timer_irq);
125132
}

0 commit comments

Comments
 (0)