mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
util: add UTI_Log2ToDouble()
This commit is contained in:
16
util.c
16
util.c
@@ -643,6 +643,22 @@ UTI_IsTimeOffsetSane(struct timeval *tv, double offset)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
double
|
||||
UTI_Log2ToDouble(int l)
|
||||
{
|
||||
if (l >= 0) {
|
||||
if (l > 31)
|
||||
l = 31;
|
||||
return 1 << l;
|
||||
} else {
|
||||
if (l < -31)
|
||||
l = -31;
|
||||
return 1.0 / (1 << -l);
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
UTI_TimevalNetworkToHost(Timeval *src, struct timeval *dest)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user