/* * copied from /home/trini/smbfs-time.c. * * Copy include/asm/div64.h to the local dir. Compile and Run. * We should see something like : * * now: 1054040154 * adjusted: 24edd64059e100 * / 10000000: 3df4e80a * 1039460362 */ #include #include #include #include "div64.h" typedef __u64 u64; #define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) static time_t smb_ntutc2unixutc(u64 ntutc) { u64 t = ntutc - NTFS_TIME_OFFSET; printf("adjusted: %Lx\n", t); do_div(t, 10000000); printf("/ 10000000: %Lx\n", t); return (time_t)t; } int main() { time_t t; t = time(NULL); printf("now: %ld\n", t); t = smb_ntutc2unixutc(0x01c29fb515986100LL); printf("%ld\n", t); return 0; }