]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: add round_timespec_to_nttime()
authorRalph Boehme <slow@samba.org>
Tue, 3 Sep 2019 15:50:54 +0000 (17:50 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 10 Sep 2019 19:05:29 +0000 (19:05 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/util/time.c
lib/util/time.h

index bd067f84e8e5e49eff434e2c3b1dbff4d0e68506..3a6043025f410033d9e1a2a81cd4e90df0ea84e6 100644 (file)
@@ -956,6 +956,15 @@ void round_timespec_to_usec(struct timespec *ts)
        }
 }
 
+/****************************************************************************
+ Round a timespec to NTTIME resolution.
+****************************************************************************/
+
+void round_timespec_to_nttime(struct timespec *ts)
+{
+       ts->tv_nsec = (ts->tv_nsec / 100) * 100;
+}
+
 /****************************************************************************
  Put a 8 byte filetime from a struct timespec. Uses GMT.
 ****************************************************************************/
index 1988b330576eba2ef2dc6a6164f511e93fd0bd99..7a8f8af35d98286c160f4dc8d945bd6212a978c1 100644 (file)
@@ -328,6 +328,7 @@ struct timespec timespec_min(const struct timespec *ts1,
 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
 void round_timespec_to_sec(struct timespec *ts);
 void round_timespec_to_usec(struct timespec *ts);
+void round_timespec_to_nttime(struct timespec *ts);
 NTTIME unix_timespec_to_nt_time(struct timespec ts);
 
 #endif /* _SAMBA_TIME_H_ */