userlibandfileserver/fileserver/sfat32/fat_dir_entry.inl
branchRCL_3
changeset 87 2f92ad2dc5db
parent 62 4a8fed1c0ef6
--- a/userlibandfileserver/fileserver/sfat32/fat_dir_entry.inl	Mon Mar 15 12:45:50 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/fat_dir_entry.inl	Wed Mar 31 23:38:45 2010 +0300
@@ -53,7 +53,7 @@
 /**
 @return The attributes for the Directory entry
 */
-inline TInt TFatDirEntry::Attributes() const
+inline TUint TFatDirEntry::Attributes() const
     {return pDir->iAttributes;}
 /**
 @param aOffset This offset will be subtracted from the returned time.
@@ -67,7 +67,7 @@
 /**
 @return The Start cluster for the file or directory for this entry 
 */
-inline TInt TFatDirEntry::StartCluster() const      
+inline TUint32 TFatDirEntry::StartCluster() const      
     {
     const TUint16 KStClustMaskHi = 0x0FFF;  
     return ((pDir->iStartClusterHi & KStClustMaskHi) << 16) | pDir->iStartClusterLo;
@@ -117,7 +117,7 @@
 
 @param anAtts The file or directory attributes
 */
-inline void TFatDirEntry::SetAttributes(TInt anAtts)
+inline void TFatDirEntry::SetAttributes(TUint anAtts)
     {
     __ASSERT_DEBUG(!(anAtts&~KMaxTUint8),Fault(EFatBadDirEntryParameter));
     pDir->iAttributes=(TUint8)anAtts;
@@ -147,7 +147,7 @@
 
 @param aStartCluster The start cluster number
 */
-inline void TFatDirEntry::SetStartCluster(TInt aStartCluster)
+inline void TFatDirEntry::SetStartCluster(TUint32 aStartCluster)
     {
     pDir->iStartClusterLo=(TUint16)(aStartCluster);
     pDir->iStartClusterHi=(TUint16)(aStartCluster >> 16);
@@ -192,7 +192,7 @@
     Get VFAT entry ID. Uset by Rugged FAT and Scan Drive to fix broken entries
     Uses 1 byte from "Last Access Date" field, offset 19. Hack.
 */
-TUint TFatDirEntry::RuggedFatEntryId() const
+TUint16 TFatDirEntry::RuggedFatEntryId() const
     {
     return pDir->iReserved2;
     }
@@ -243,6 +243,28 @@
 
 
 
+//-----------------------------------------------------------------------------
+/**
+    Checks if the entry has the same "modification time" as given (with 2 seconds granularity precision, see FAT specs). 
+    
+    @param  aTime   time to check
+    @param  aOffset time offset
+
+    @return ETrue if the given time+offset is the same (with 2 second granularity) as the one set in the entry.
+*/
+inline TBool TFatDirEntry::IsTimeTheSame(TTime aTime, TTimeIntervalSeconds aOffset) const
+    {
+    aTime+=aOffset;
+
+    const TUint16 time = (TUint16)DosTimeFromTTime(aTime);
+    if(time != pDir->iTime)
+        return EFalse;
+
+    const TUint16 date = (TUint16)DosDateFromTTime(aTime);
+    return (date == pDir->iDate);
+    }
+
+
 #endif //FAT_DIR_ENTRY_INL