summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-06-20 13:23:31 -0700
committerJeremy Allison <jra@samba.org>2008-06-20 13:23:31 -0700
commitc4d6ca41d919cfec11b0f05e8b2f3bffbfadefcc (patch)
treeb2dfb029d71a3002af971842a7080e2b0a1f00c3 /source3/lib
parent2a4b8fa6642204acb538cfb9d5e481538d9b53c0 (diff)
downloadsamba-c4d6ca41d919cfec11b0f05e8b2f3bffbfadefcc.tar.gz
samba-c4d6ca41d919cfec11b0f05e8b2f3bffbfadefcc.tar.bz2
samba-c4d6ca41d919cfec11b0f05e8b2f3bffbfadefcc.zip
Fix bug #5531 - fix conversion of ns units when converting from nttime to timespec.
Fix from hkurma@datadomain.com. Jeremy. (This used to be commit 8c87a4319cc83f55fb105cae81a8efbc3fb5b98b)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/time.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/lib/time.c b/source3/lib/time.c
index e5fd929d0f..17990b9269 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -1211,8 +1211,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;