fixed bug #1536377 - incorrect timestamps on big-endian platforms

instead of messing with structs, use simple arithmetic ops to split the time to low & high words


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4738 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2006-08-19 12:47:17 +00:00
parent 23bc91327d
commit 71e601f11f

View file

@ -4744,18 +4744,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
struct stat st; struct stat st;
if (!stat(line.gettoken_str(1), &st)) if (!stat(line.gettoken_str(1), &st))
{ {
union unsigned long long ll = (st.st_mtime * 10000000LL) + 116444736000000000LL;
{ high = (DWORD) (ll >> 32);
struct low = (DWORD) ll;
{
long l;
long h;
} words;
long long ll;
};
ll = (st.st_mtime * 10000000LL) + 116444736000000000LL;
high = words.h;
low = words.l;
} }
else else
{ {
@ -6076,22 +6067,13 @@ int CEXEBuild::add_file(const string& dir, const string& file, int attrib, const
struct stat st; struct stat st;
if (!fstat(fd, &st)) if (!fstat(fd, &st))
{ {
union unsigned long long ll = (st.st_mtime * 10000000LL) + 116444736000000000LL;
{
struct
{
long l;
long h;
} words;
long long ll;
};
ll = (st.st_mtime * 10000000LL) + 116444736000000000LL;
// FAT write time has a resolution of 2 seconds // FAT write time has a resolution of 2 seconds
ll -= ll % 20000000; ll -= ll % 20000000;
ent.offsets[3] = words.l; ent.offsets[3] = (int) ll;
ent.offsets[4] = words.h; ent.offsets[4] = (int) (ll >> 32);
} }
#endif #endif
else else