Move td_ntfs2utc() to src/common.c

This commit is contained in:
Christophe Grenier 2013-04-19 07:57:37 +02:00
parent 4470b802c0
commit e6f2c37ad0
4 changed files with 15 additions and 30 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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)
{

View file

@ -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;