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)
Fat32: time of the created file
- dusan.poluga
- mikroElektronika team
- Posts: 780
- Joined: 02 Feb 2017 14:21
Re: Fat32: time of the created file
Hi,
Please try to declare the filename in a array like this.
Then in your main assign it like this.
And assign the time values like shown.
The time in this structure will not update automatically the user will have to update it.
Time can be incremented like this.
To get the creation time you would run the command like shown below.
Best Regards,
Please try to declare the filename in a array like this.
Code: Select all
var FileName: string[20];
var TimeCre : __TIME;
Code: Select all
FileName := 'FILE1.TXT';
Code: Select all
TimeCre.Year := 2011; // initialize time ...
TimeCre.Month := 8;
TimeCre.Day := 11;
TimeCre.Hour := 16;
TimeCre.Minute := 20;
TimeCre.Second := 11;
Time can be incremented like this.
Code: Select all
FAT32_IncTime(2*60*60 + 30*60 + 40); // increment time stamp by 2 hours, 30 minutes and 40 seconds
Code: Select all
FAT32_getCTime(@FileName, @tm);
Best Regards,
Dusan Poluga.
Re: Fat32: time of the created file
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 ?
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 ?
- petar.suknjaja
- mikroElektronika team
- Posts: 683
- Joined: 05 Mar 2018 09:44
- Location: Belgrade
Re: Fat32: time of the created file
Hi,
Can you post some more details about your problem?
Kind regards,
Petar
Can you post some more details about your problem?
Kind regards,
Petar
Re: Fat32: time of the created file
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.
// --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.
- petar.suknjaja
- mikroElektronika team
- Posts: 683
- Joined: 05 Mar 2018 09:44
- Location: Belgrade
Re: Fat32: time of the created file
Hi,
Nice to hear that you managed to find the solution for yourself.
Kind regards,
Petar
Nice to hear that you managed to find the solution for yourself.
Kind regards,
Petar