time_init: fix zero divide on KVM

This commit is contained in:
NAKAMURA Gou
2015-11-06 19:21:04 +09:00
parent 0ad7c8ac50
commit be78eb752e

View File

@ -213,8 +213,14 @@ static void time_init(void)
origin_ts.tv_sec = tv_sec;
origin_ts.tv_nsec = tv_nsec;
clocks_per_sec = (1000L * NS_PER_SEC) / ns_per_kclock;
if (ns_per_kclock) {
clocks_per_sec = (1000L * NS_PER_SEC) / ns_per_kclock;
}
if (!ns_per_kclock) {
gettime_local_support = 0;
}
return;
}