summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-11 03:26:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:40 -0500
commit097d568383606135bafe4f6dbc3b3055a02f86b5 (patch)
tree5864294067a7f74a3e0b28367982e033c0f73d0f /source4
parenta7a5c98e296763c541daac2e6175ead8ede34c64 (diff)
downloadsamba-097d568383606135bafe4f6dbc3b3055a02f86b5.tar.gz
samba-097d568383606135bafe4f6dbc3b3055a02f86b5.tar.bz2
samba-097d568383606135bafe4f6dbc3b3055a02f86b5.zip
r4670: abartlet was worried about floating point precision with my first
version - here is one based purely on 64 bit math (This used to be commit 1ff04b0dc3e680b6288622576bb373359a594c2f)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/time.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source4/lib/time.c b/source4/lib/time.c
index 92eb2dee5e..fd005215a1 100644
--- a/source4/lib/time.c
+++ b/source4/lib/time.c
@@ -543,6 +543,6 @@ struct timeval timeval_diff(struct timeval *tv1, struct timeval *tv2)
*/
NTTIME timeval_to_nttime(struct timeval *tv)
{
- double t1 = tv->tv_sec + (tv->tv_usec*1.0e-6);
- return (t1 + TIME_FIXUP_CONSTANT) * 1.0e7;
+ return 10*(tv->tv_usec +
+ ((TIME_FIXUP_CONSTANT + (uint64_t)tv->tv_sec) * 1000000));
}