diff options
author | Ralph Boehme <slow@samba.org> | 2019-09-03 17:50:54 +0200 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2019-09-10 19:05:29 +0000 |
commit | 5403bb22e6cb39baf6dc1b91558744d41e9f6f64 (patch) | |
tree | 18a88d3ca5f797593c0ad7028139faefa7efd490 /lib/util | |
parent | 2ecab3c60abf9baa16a6a5e3eba0fc4720def840 (diff) | |
download | samba-5403bb22e6cb39baf6dc1b91558744d41e9f6f64.tar.gz |
lib: add round_timespec_to_nttime()
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>
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/time.c | 9 | ||||
-rw-r--r-- | lib/util/time.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/util/time.c b/lib/util/time.c index bd067f84e8e..3a6043025f4 100644 --- a/lib/util/time.c +++ b/lib/util/time.c @@ -957,6 +957,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. ****************************************************************************/ diff --git a/lib/util/time.h b/lib/util/time.h index 1988b330576..7a8f8af35d9 100644 --- a/lib/util/time.h +++ b/lib/util/time.h @@ -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_ */ |