Article View: borland.public.cppbuilder.nativeapi
Article #10647Re: FindFirstFile, FILETIME, and Daylight Savings
From: Bob Gonder
Date: Tue, 06 Apr 2004 21:48
Date: Tue, 06 Apr 2004 21:48
71 lines
3451 bytes
3451 bytes
Bob Gonder wrote:
>Andrue Cope wrote:
>
>>On Mon, 05 Apr 2004 11:13:20 -0700, Bob Gonder wrote:
>>
>>I'd hope not but could CompareFileTime allow for local time? Surely not. In
>>any case you can compare FileTimes directly as they're just 64bit numbers.
>
>Hmmm.. if( (DWORDLONG)OldTime == (DWORDLONG)ftCreationTime ) ?
No, "cannot cast" so...
typedef union uFT264{
FILETIME ft;
DWORDLONG i64;
}FT264;
Won't let me cast that either, so copy it.
FT264 fti,ftj;
fti.ft = CRCRecord[i].time;
ftj.ft = fblk->ftCreationTime;
if( (CRCRecord[i].Size != fblk->nFileSizeLow) ||
( fti.i64 != ftj.i64 ) )
{ /* it's changed! */
};
Same result as CompareTime.
I had partially run the old code.
The new code compared favorably with the files read on Sunday, but
continued to reject files that were ok Friday.
It really looks like FindFirst/NextFile returns a DST compensated
time.
I'll keep the union. I don't like copying the data, but the compare is
inline, which I _do_ like.
I'll try saving a converted time:
LocalFileTimeToFileTime(&fblk->ftCreationTime, &CRCRecord[i].time );
and see what happens.....
Nope.
Changed date to March, rebooted, ran the above line, it said
everything changed (ok, first time you'd expect that). Ran it again,
said nothing changed (so far so good). Changed date back to now, ran
this
fti.ft = CRCRecord[i].time;
LocalFileTimeToFileTime( &fblk->ftCreationTime, &ftj.ft );
//ftj.ft = fblk->ftCreationTime;
if( (CRCRecord[i].Size != fblk->nFileSizeLow) ||
( fti.i64 != ftj.i64 ) )
{
and it still changed. Also seems slower.
The original code was
FileNotFoundInCrcRecord:
CRCRecord[CRCOpened].Size = fblk.nFileSizeLow;
CRCRecord[CRCOpened].time = fblk.ftCreationTime;
NoMoreFiles:
WriteFile(h,&CRCRecord[0],j*sizeof(crcrecord),&written,NULL);
FilenameFoundInCrcRecord:
if( (CRCRecord[i].Size != fblk->nFileSizeLow) ||
(CompareFileTime(&CRCRecord[i].time,&fblk->ftCreationTime)!=0))
{ return FileNotFoundInCrcRecord;
Takes a couple hours to recalc all the crcs. That's why I keep a db
and first check the size/date/time and only calc those that changed.
The files don't get modified, so creation time is good enough.
More tests to follow....
Technical Details
Message-ID:
<vhu570hntcel1a7q8bdb59cgdqmudhtkv7@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<1c8170tliot8sh3tp2gfk0v61as6l3uqti@4ax.com> <ak8rt8ua80v1$.zw3u0r86c55l.dlg@40tude.net> <ma6370d3jao3sjn3craod7n6jo4eioraq8@4ax.com> <8ptgrgaex8m6$.lkys4jypdxw.dlg@40tude.net> <bnn57013vvtk88ev5p544m0tq1gbuair87@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,2bff2a2748be0347 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-06 15:10:11 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: FindFirstFile, FILETIME, and Daylight Savings Date: Tue, 06 Apr 2004 14:48:33 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <vhu570hntcel1a7q8bdb59cgdqmudhtkv7@4ax.com> References: <1c8170tliot8sh3tp2gfk0v61as6l3uqti@4ax.com> <ak8rt8ua80v1$.zw3u0r86c55l.dlg@40tude.net> <ma6370d3jao3sjn3craod7n6jo4eioraq8@4ax.com> <8ptgrgaex8m6$.lkys4jypdxw.dlg@40tude.net> <bnn57013vvtk88ev5p544m0tq1gbuair87@4ax.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 4.228.213.49 X-Trace: newsgroups.borland.com 1081288115 4.228.213.49 (6 Apr 2004 14:48:35 -0800) Lines: 73 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail