From 1af0aa92b3f3467715f6ffbfedf66df1acc0a83c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 21 Aug 2009 21:44:21 -0700 Subject: Fix bug 6529 - Offline files conflict with Vista and Office 2003 On filesystems that can't store less than one second timestamps, round the incoming timestamp set requests so the client can't discover that a time set request has been truncated by the filesystem. Needs backporting to 3.4, 3.3, 3.2 and (even) 3.0. Jeremy --- source3/lib/time.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/lib/time.c') diff --git a/source3/lib/time.c b/source3/lib/time.c index a2e615acc5..06605cd30a 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -467,6 +467,17 @@ int timespec_compare(const struct timespec *ts1, const struct timespec *ts2) return 0; } +/**************************************************************************** + Round up a timespec if nsec > 500000000, round down if lower, + then zero nsec. +****************************************************************************/ + +void round_timespec(struct timespec *ts) +{ + ts->tv_sec += ts->tv_nsec >= 500000000 ? 1 : 0; + ts->tv_nsec = 0; +} + /**************************************************************************** Interprets an nt time into a unix struct timespec. Differs from nt_time_to_unix in that an 8 byte value of 0xffffffffffffffff -- cgit