From d183dc676db0d91ae6b0759c8fd094c4a888d29d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 20 Jun 2008 13:23:31 -0700 Subject: [PATCH] Fix bug #5531 - fix conversion of ns units when converting from nttime to timespec. Fix from hkurma@datadomain.com. Jeremy. --- source/lib/time.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/lib/time.c b/source/lib/time.c index a703066248e..8e28fccca7b 100644 --- a/source/lib/time.c +++ b/source/lib/time.c @@ -1212,8 +1212,12 @@ struct timespec nt_time_to_unix_timespec(NTTIME *nt) d = (int64)*nt; /* d is now in 100ns units, since jan 1st 1601". Save off the ns fraction. */ - - ret.tv_nsec = (long) ((d % 100) * 100); + + /* + * Take the last seven decimal digits and multiply by 100. + * to convert from 100ns units to 1ns units. + */ + ret.tv_nsec = (long) ((d % (1000 * 1000 * 10)) * 100); /* Convert to seconds */ d /= 1000*1000*10; -- 2.11.4.GIT