diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/netmisc.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 6834b9c3bec1..b333ff60781d 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -925,11 +925,23 @@ cifs_NTtimeToUnix(__le64 ntutc) | |||
925 | /* BB what about the timezone? BB */ | 925 | /* BB what about the timezone? BB */ |
926 | 926 | ||
927 | /* Subtract the NTFS time offset, then convert to 1s intervals. */ | 927 | /* Subtract the NTFS time offset, then convert to 1s intervals. */ |
928 | u64 t; | 928 | s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; |
929 | |||
930 | /* | ||
931 | * Unfortunately can not use normal 64 bit division on 32 bit arch, but | ||
932 | * the alternative, do_div, does not work with negative numbers so have | ||
933 | * to special case them | ||
934 | */ | ||
935 | if (t < 0) { | ||
936 | t = -t; | ||
937 | ts.tv_nsec = (long)(do_div(t, 10000000) * 100); | ||
938 | ts.tv_nsec = -ts.tv_nsec; | ||
939 | ts.tv_sec = -t; | ||
940 | } else { | ||
941 | ts.tv_nsec = (long)do_div(t, 10000000) * 100; | ||
942 | ts.tv_sec = t; | ||
943 | } | ||
929 | 944 | ||
930 | t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; | ||
931 | ts.tv_nsec = do_div(t, 10000000) * 100; | ||
932 | ts.tv_sec = t; | ||
933 | return ts; | 945 | return ts; |
934 | } | 946 | } |
935 | 947 | ||