diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/dokan/utils.cc | |
parent | Initial commit. (diff) | |
download | ceph-upstream/18.2.2.tar.xz ceph-upstream/18.2.2.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/dokan/utils.cc')
-rw-r--r-- | src/dokan/utils.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/dokan/utils.cc b/src/dokan/utils.cc new file mode 100644 index 000000000..576cceb99 --- /dev/null +++ b/src/dokan/utils.cc @@ -0,0 +1,30 @@ +/* + * ceph-dokan - Win32 CephFS client based on Dokan + * + * Copyright (C) 2021 SUSE LINUX GmbH + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * +*/ + +#include "utils.h" + +void to_filetime(time_t t, LPFILETIME pft) +{ + // Note that LONGLONG is a 64-bit value + LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000; + pft->dwLowDateTime = (DWORD)ll; + pft->dwHighDateTime = ll >> 32; +} + +void to_unix_time(FILETIME ft, time_t *t) +{ + ULARGE_INTEGER ui; + ui.LowPart = ft.dwLowDateTime; + ui.HighPart = ft.dwHighDateTime; + + *t = (LONGLONG)(ui.QuadPart / 10000000ULL - 11644473600ULL); +} |