]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: add a comment to nt_time_to_full_timespec()
authorRalph Boehme <slow@samba.org>
Fri, 6 Dec 2019 16:48:19 +0000 (16:48 +0000)
committerRalph Boehme <slow@samba.org>
Mon, 9 Dec 2019 16:10:38 +0000 (16:10 +0000)
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 <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/util/time.c

index d8f1daca901451b512939bfebac4c6f8ec1a7926..0fac5e2e39789b73d0a8a9f869d774b801a2c3bf 100644 (file)
@@ -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;