diff --git a/src/common.c b/src/common.c index 42cd5c18..c074d50a 100644 --- a/src/common.c +++ b/src/common.c @@ -262,3 +262,17 @@ void set_secwest(void) #endif } +/** + * td_ntfs2utc - Convert an NTFS time to Unix time + * @time: An NTFS time in 100ns units since 1601 + * + * NTFS stores times as the number of 100ns intervals since January 1st 1601 at + * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. + * + * Return: n A Unix time (number of seconds since 1970) + */ +#define NTFS_TIME_OFFSET ((int64_t)(369 * 365 + 89) * 24 * 3600 * 10000000) +time_t td_ntfs2utc (int64_t ntfstime) +{ + return (ntfstime - (NTFS_TIME_OFFSET)) / 10000000; +} diff --git a/src/common.h b/src/common.h index 019c4abe..1de1042c 100644 --- a/src/common.h +++ b/src/common.h @@ -432,6 +432,7 @@ void set_part_name_chomp(partition_t *partition, const unsigned char *src, const char* strip_dup(char* str); int date_dos2unix(const unsigned short f_time,const unsigned short f_date); void set_secwest(void); +time_t td_ntfs2utc (int64_t ntfstime); #ifndef BSD_MAXPARTITIONS #define BSD_MAXPARTITIONS 8 #endif diff --git a/src/ntfs_dir.c b/src/ntfs_dir.c index 34d33424..779b6df7 100644 --- a/src/ntfs_dir.c +++ b/src/ntfs_dir.c @@ -83,7 +83,6 @@ #define PATH_SEP '/' #define NTFS_DT_DIR 4 #define NTFS_DT_REG 8 -#define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) #ifndef FILE_first_user #define FILE_first_user 16 #endif @@ -102,7 +101,6 @@ extern struct ntfs_device_operations ntfs_device_testdisk_io_ops; extern int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, void *dirent, ntfs_filldir_t filldir); -static time_t td_ntfs2utc (s64 ntfstime); static int ntfs_td_list_entry( struct ntfs_dir_struct *ls, const ntfschar *name, const int name_len, const int name_type, const s64 pos, const MFT_REF mref, const unsigned dt_type); @@ -133,20 +131,6 @@ static int index_get_size(ntfs_inode *inode) return iroot->index_block_size; } -/** - * td_ntfs2utc - Convert an NTFS time to Unix time - * @time: An NTFS time in 100ns units since 1601 - * - * NTFS stores times as the number of 100ns intervals since January 1st 1601 at - * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. - * - * Return: n A Unix time (number of seconds since 1970) - */ -static time_t td_ntfs2utc (s64 ntfstime) -{ - return (ntfstime - (NTFS_TIME_OFFSET)) / 10000000; -} - #ifdef HAVE_ICONV static int ntfs_ucstoutf8(iconv_t cd, const ntfschar *ins, int ins_len, char **outs, int outs_len) { diff --git a/src/ntfs_udl.c b/src/ntfs_udl.c index e838c53e..9f3c4ebb 100644 --- a/src/ntfs_udl.c +++ b/src/ntfs_udl.c @@ -166,20 +166,6 @@ struct ufile { char padding[4]; /* Unused: padding to 64 bit. */ }; -/** - * td_ntfs2utc - Convert an NTFS time to Unix time - * @time: An NTFS time in 100ns units since 1601 - * - * NTFS stores times as the number of 100ns intervals since January 1st 1601 at - * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. - * - * Return: n A Unix time (number of seconds since 1970) - */ -static time_t td_ntfs2utc (s64 ntfstime) -{ - return (ntfstime - (NTFS_TIME_OFFSET)) / 10000000; -} - static const char *UNKNOWN = "unknown"; static struct options opts;