Xsec to jiffies convertion
This commit is contained in:
parent
c65c7bb7b0
commit
f7525f9e76
15
core/time.c
15
core/time.c
@ -11,3 +11,18 @@ unsigned int jiffies_to_usecs(const unsigned long j)
|
||||
{
|
||||
return (1000000L / HZ) * j;
|
||||
}
|
||||
|
||||
unsigned long msecs_to_jiffies(const unsigned int m)
|
||||
{
|
||||
#if HZ >= 1000 && !(HZ % 1000)
|
||||
return m * (HZ / 1000L);
|
||||
#else
|
||||
// This could overflow
|
||||
return (m * HZ) / 1000L;
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned long usecs_to_jiffies(const unsigned int u){
|
||||
// This could overflow
|
||||
return (u * HZ) / 1000000L;
|
||||
}
|
||||
|
@ -48,3 +48,5 @@ extern unsigned long volatile jiffies;
|
||||
|
||||
unsigned int jiffies_to_msecs(const unsigned long j);
|
||||
unsigned int jiffies_to_usecs(const unsigned long j);
|
||||
unsigned long msecs_to_jiffies(const unsigned int m);
|
||||
unsigned long usecs_to_jiffies(const unsigned int u);
|
||||
|
Loading…
Reference in New Issue
Block a user