From: Ralph Boehme Date: Fri, 6 Dec 2019 16:48:19 +0000 (+0000) Subject: lib: add a comment to nt_time_to_full_timespec() X-Git-Tag: ldb-2.1.0~381 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1230f6e45bb076af9f6efda04405b0874430681;p=thirdparty%2Fsamba.git lib: add a comment to nt_time_to_full_timespec() Add a hint explaining why and how -1 should be treated differently in the future. Also make use of the helper function make_omit_timespec(). Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- diff --git a/lib/util/time.c b/lib/util/time.c index d8f1daca901..0fac5e2e397 100644 --- a/lib/util/time.c +++ b/lib/util/time.c @@ -1126,8 +1126,18 @@ struct timespec nt_time_to_full_timespec(NTTIME nt) int64_t d; struct timespec ret; - if ((nt == 0) || (nt == (int64_t)-1)) { - return (struct timespec){.tv_nsec = SAMBA_UTIME_OMIT}; + if (nt == NTTIME_OMIT) { + return make_omit_timespec(); + } + if (nt == NTTIME_FREEZE) { + /* + * This should be returned as SAMBA_UTIME_FREEZE in the + * future. + */ + return make_omit_timespec(); + } + if (nt > NTTIME_MAX) { + nt = NTTIME_MAX; } d = (int64_t)nt;