summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-04-19 07:57:37 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-04-19 07:57:37 +0200
commite6f2c37ad0bab53a7603f7925cf482881b7df9d9 (patch)
tree1984e3decb55a15b4d6bd2ba0c5d93eb24769353 /src
parent4470b802c0d66435b566ca708eb610e588561de4 (diff)
Move td_ntfs2utc() to src/common.c
Diffstat (limited to 'src')
-rw-r--r--src/common.c14
-rw-r--r--src/common.h1
-rw-r--r--src/ntfs_dir.c16
-rw-r--r--src/ntfs_udl.c14
4 files changed, 15 insertions, 30 deletions
diff --git a/src/common.c b/src/common.c
index 42cd5c1..c074d50 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 019c4ab..1de1042 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 34d3342..779b6df 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 e838c53..9f3c4eb 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;