It is currently 23 Apr 2018 16:35

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 07 Jul 2017 16:33 
Offline

Joined: 07 Jul 2017 15:40
Posts: 3
Hi.
How to get the time of the created file?

FAT32_GetAttr - This routine extracts file attributes information. (only: attr : ^uint8).
FAT32_GetCTime - This routine gets created time of a file.
FAT32_GetMTime - This routine gets modified time of a file.

with Library:
var TimeCre : __TIME;

FAT32_GetCTime('FILE_A.TXT', @TimeCre); //

Error: Incompatable types (comlex type to simple type)


Top
 Profile  
 
PostPosted: 11 Jul 2017 09:24 
Offline
mikroElektronika team
User avatar

Joined: 02 Feb 2017 14:21
Posts: 780
Hi,

Please try to declare the filename in a array like this.
var FileName: string[20];
var TimeCre : __TIME;

Then in your main assign it like this.
FileName  := 'FILE1.TXT';


And assign the time values like shown.
        TimeCre.Year   := 2011;       // initialize time ...
        TimeCre.Month  := 8;
        TimeCre.Day    := 11;
        TimeCre.Hour   := 16;
        TimeCre.Minute := 20;
        TimeCre.Second := 11;

The time in this structure will not update automatically the user will have to update it.
Time can be incremented like this.
FAT32_IncTime(2*60*60 + 30*60 + 40);   // increment time stamp by 2 hours, 30 minutes and 40 seconds


To get the creation time you would run the command like shown below.
FAT32_getCTime(@FileName, @tm);



Best Regards,

_________________
Dusan Poluga.


Top
 Profile  
 
PostPosted: 13 Apr 2018 18:00 
Offline

Joined: 07 Jul 2017 15:40
Posts: 3
Hi.
There are many files on the SD.
One of them is FILE1.TXT

--A----- 6194 13/04/2018 19:17 FILE1.TXT

How to read the date: 13/04/2018 and time: 19:17 ?


Top
 Profile  
 
PostPosted: 16 Apr 2018 18:13 
Offline
User avatar

Joined: 05 Mar 2018 09:44
Posts: 91
Location: Belgrade
Hi,

Can you post some more details about your problem?

Kind regards,
Petar


Top
 Profile  
 
PostPosted: 17 Apr 2018 08:43 
Offline

Joined: 07 Jul 2017 15:40
Posts: 3
Hi.

// --A----- 6194 11/04/2018 15:50 FILE1.TXT
// tm, TimeCre : __TIME; //

File_ := FILE1.TXT;
if (0 = FAT32_GetCTime(@File_, @TimeCre)) then //if operation was successful
begin // ...
end;
ByteToStr(TimeCre.Day, txt); //
UART2_Write_Text(txt); UART2_Write_Text(' '); //
ByteToStr(TimeCre.Month, txt); //
UART2_Write_Text(txt); UART2_Write_Text(' '); //
ByteToStr(TimeCre.Year -2000, txt); //
UART2_Write_Text(txt); UART2_Write_Text(' '); //
ByteToStr(TimeCre.Hour, txt); //
UART2_Write_Text(txt); UART2_Write_Text(' ');//
ByteToStr(TimeCre.Minute, txt); //
UART2_Write_Text(txt); //
UART2_Write(13);UART2_Write(10);

On the screen: 16 4 18 19 13
What type: Day, Month, Year, Hour, Minute? Byte or word or ... ?

Yes!!!
FAT32_Dir(): --A----- 6194 11/04/2018 15:50 FILE1.TXT - date of change
FAT32_GetCTime: On the screen: 16 4 18 19 13 - date of creation

All OK.


Top
 Profile  
 
PostPosted: 23 Apr 2018 16:06 
Offline
User avatar

Joined: 05 Mar 2018 09:44
Posts: 91
Location: Belgrade
Hi,
Nice to hear that you managed to find the solution for yourself.

Kind regards,
Petar


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: