]>
git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - fs/cifsd/netmisc.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) International Business Machines Corp., 2002,2008
4 * Author(s): Steve French (sfrench@us.ibm.com)
6 * Error mapping routines from Samba libsmb/errormap.c
7 * Copyright (C) Andrew Tridgell 2001
13 #include "time_wrappers.h"
16 * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units)
17 * into Unix UTC (based 1970-01-01, in seconds).
19 struct timespec64
ksmbd_NTtimeToUnix(__le64 ntutc
)
23 /* Subtract the NTFS time offset, then convert to 1s intervals. */
24 s64 t
= le64_to_cpu(ntutc
) - NTFS_TIME_OFFSET
;
28 * Unfortunately can not use normal 64 bit division on 32 bit arch, but
29 * the alternative, do_div, does not work with negative numbers so have
30 * to special case them
34 ts
.tv_nsec
= do_div(abs_t
, 10000000) * 100;
35 ts
.tv_nsec
= -ts
.tv_nsec
;
39 ts
.tv_nsec
= do_div(abs_t
, 10000000) * 100;