thanks it served my purpose Have a good day Cheers Vik
On Fri, May 1, 2009 at 1:15 PM, Jianming Lin (FMI) <[email protected]>wrote: > Sorry, guys, made mistake. > > > > If a file is saved in FAT32, file time is recorded as local time. > > > > Win32 API function FindFirstFile will automatically test that if a file is > in FAT32 system, it will convert the local time to UTC time, and put it in > the variable of > > TWin32FindData. ftLastWriteTime. > > > > We don’t need to call > > LocalFileTimeToFileTime(LocalFileTime, UTC_FTime); //convert to UTC time > > As in > > function FAT_GetFileUTC_Time(const FileName: string; var FileUTC_Time: > TSystemTime): boolean; > > > > > > You can see that if a file is saved in FAT32 media, say at 3:00pm 25/09/09. > > After day light saving time started for example on 01/11/09, > > Use function GetFileUTC_Time will return 2:00am 25/09/09. > > > > Use the following method will return 3:00am 25/09/09 which is correct. > > > > > //--------------------------------------------------------------------------------------- > > function GetFileUTC_Time(FileName:string; var FileRaw_Time: Integer): > boolean; > > var fHdl: integer; > > fInfo: TByHandleFileInformation; > > begin > > result := false; > > fHdl := fileopen(FileName, fmOpenRead ); > > try > > if GetFileInformationByHandle(fHdl, fInfo) then > //FileTimeToSystemTime(fInfo.ftLastWriteTime, FileRaw_Time); > > result := FileTimeToDosDateTime(fInfo.ftLastWriteTime, > LongRec(FileRaw_Time).Hi, LongRec(FileRaw_Time).Lo); > > finally > > fileClose(fHdl); > > end; > > end; > > > > > > > ------------------------------ > > *From:* [email protected] [mailto:[email protected]] > *On Behalf Of *Vikas... > *Sent:* Friday, 1 May 2009 2:07 a.m. > *To:* NZ Borland Developers Group - Delphi List > *Subject:* [DUG] Help in getting file age > > > > Dear Everyone, > > > I need a help in calculating the age of file. > > I have checked the function file age. But it dint serve the purpose. > > Reason being is. Let say i am sitting in India changed a file on 30th April > at 7:15pm. But on the other hand some one from america modifies the same > files at 9:30am on 30th April since we have time difference of 12 hours from > US. So how do i make sure this file modified at 9:30am is the new one. > > Since according the file age filed modified at 7:15pm that is later one is > new. Which is not right. > > Anyone ever worked on such things before. > > I hope my query makes sense. > > Cheers > Vik > > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: [email protected] > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to [email protected] with Subject: > unsubscribe > -- vikas
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe
