Skip to main content
dbgarasiya
Senior
October 10, 2019
Question

Showing date and time of file creation in sd card

  • October 10, 2019
  • 4 replies
  • 3393 views

Hello

I have interfaced sd card with controller STM32F779BI

i have write text file in sd card but i could not see at what time file is written to sd card doesn't show in properties of that text file

is this is possible , if yes then how can i do that ?

Best Regards

Dipak Garasiya

This topic has been closed for replies.

4 replies

berendi
Principal
October 10, 2019

You should implement the get_fattime() function. This function should return the current date and time from your RTC packed as bitfields in a 32-bit integer.

The exact layout is documented on the fatfs website.

dbgarasiya
Senior
October 10, 2019

thanks for reply @berendi

dbgarasiya
Senior
October 10, 2019

thanks again for giving me suggestion

DBaya.1
Associate
February 7, 2022

Thanks a lot also!!!

I implement that:

DWORD get_fattime(void)

{

 /* USER CODE BEGIN get_fattime */

RTC_TimeTypeDef sZeit;

RTC_DateTypeDef sDatum;

DWORD attime;

HAL_RTC_GetTime(&hrtc, &sZeit, RTC_FORMAT_BIN);

HAL_RTC_GetDate(&hrtc, &sDatum, RTC_FORMAT_BIN);

attime = (((DWORD)sDatum.Year - 1980) << 25)

| ((DWORD)sDatum.Month << 21)

| ((DWORD)sDatum.Date << 16)

| (WORD)(sZeit.Hours << 11)

| (WORD)(sZeit.Minutes << 5)

| (WORD)(sZeit.Seconds >> 1);

return attime;

/* USER CODE END get_fattime */

}

Works very well...