Re: Bug in NT_TZBUG_WORKAROUND
"Cosmin T" <[email protected]> Wed, 18 Feb 2004 23:54:50 -0500
| Newsgroups | gmane.comp.archivers.info-zip |
|---|---|
| Message-ID | <[email protected]> |
At the risk of driving Christian crazy, I am going to continue with
this discussion. But before that, I want to thank Christian for the
very detailed explanations. I was not aware of the rationale of
Info-ZIP's decision to deliberately create time stamps that are offset
by 1hr (but now I do). Still, this behavior is not useful to me.
I knew the fact that the IsDST(today) flag is involved in the
universal time <-> local file time conversion, although I did not
know exactly to what degree. I thought that Microsoft considers it
a "feature" (according to the Knowledge Base article #128126, which
apparently I cannot find anymore); now I see that they consider it
a "bug" (according to article #158588), and they don't say that it's
present on Windows XP or later (... is it?)
http://support.microsoft.com/?id=158588
I understand that the behavior I was complaining about is intended,
and it may be useful to the majority of your users, but it is not
useful to me. It's inconsistent with the other tools that I use.
So I get confused if I don't keep track of what tools I use, and
where I do the work.
And here is my question:
Would you please agree to accept, at least, the introduction of a
compile-time flag, say, NO_NT_TZBUG_OFFSET? By enabling it, I could
make my own, custom builds of zip and unzip, that fit my purposes.
I believe some other people will find this useful, too.
**
(If you really want to know why am I so fond of local times, you can
read the explanations below; otherwise, you can skip directly to the
patch at the end.)
Thank you for explaining me the reason why you chose to create
apparently incorrect local file times on NTFS. As you explain in Q14
in the Info-ZIP FAQ, you create correct universal time stamps.
Yet, I wish to have correct (read: "correct") local time stamps.
Frequently, I move files between FAT and NTFS partitions. I keep my
records exclusively in local time, because all the other tools I work
with preserve the local time. That includes the standard Windows tools,
and 3rd parties like the file manager I use, and also the archivers:
PKZip, MS Cabarc, 7-ZIP, my particular build of TAR, etc.
So it's easy for me to keep track of only one messy issue (and I do that
by refreshing the time stamps from my archived backups two times a year,
when the DST changes). I'd rather not need to pay attention to other
issues, such as where do I do my work:
create zip archive on FAT
create zip archive on NTFS (same files, copied with std. tools)
=> archives with different time stamps.
Also, it's disturbing when different programs act differently.
For example (on NTFS):
extract tar archive
create zip archive
or
extract zip archive
create 7zip archive
=> new archives with altered time stamps.
Someone suggested to deactivate the DST. This does keep the local
filetimes unaltered during the year, indeed, but it is not a solution.
The conversion between local time and universal time is incorrect if
the time stamp belongs to the summer period.
**
Even if the patch is apparently sub-optimal, it incurrs little
intrusion, and the compiler optimizes away local variables
(fs_uses_loctime) to which a constant value is assigned only once.
Best regards,
Cosmin
--- win32/win32.c~ Sat May 10 14:10:46 2003
+++ win32/win32.c Tue Feb 17 11:16:00 2004
@@ -130,7 +130,9 @@
#if (defined(USE_EF_UT_TIME) || defined(NT_TZBUG_WORKAROUND) || \
defined(TIMESTAMP))
static void utime2FileTime(time_t ut, FILETIME *pft);
+#ifndef NO_NT_TZBUG_OFFSET
static int FStampIsLocTime(__GPRO__ const char *path);
+#endif
#endif /* USE_EF_UT_TIME || NT_TZBUG_WORKAROUND || TIMESTAMP */
#ifdef NT_TZBUG_WORKAROUND
static int FileTime2utime(const FILETIME *pft, time_t *ut);
@@ -649,10 +651,14 @@
/* Function FStampIsLocTime() */
/******************************/
+#ifndef NO_NT_TZBUG_OFFSET
static int FStampIsLocTime(__GPRO__ const char *path)
{
return (NTQueryVolInfo(__G__ path) ? G.lastVolLocTim : FALSE);
}
+#else
+# define FStampIsLocTime(a) 1
+#endif
#endif /* USE_EF_UT_TIME || NT_TZBUG_WORKAROUND || TIMESTAMP */
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca