FreeRTOS_FTP_server.c does not compile if ffconfigTIME_SUPPORT is 0

rasty1 wrote on Wednesday, August 03, 2016:

Hi,
What do I miss?
Thanks
Rasty

./FreeRTOS-Plus-TCP/protocols/FTP/FreeRTOS_FTP_server.c: In function ‘prvSizeDateFile’:
…/FreeRTOS-Plus-TCP/protocols/FTP/FreeRTOS_FTP_server.c:2322:27: error: ‘FF_Stat_t’ has no member named ‘st_mtime’
time_t secs = xStatBuf.st_mtime;

In function prvSizeDateFile
if( xSendDate != pdFALSE )
{
FF_TimeStruct_t tmStruct;
time_t secs = xStatBuf.st_mtime; <<------ no st_mtime

heinbali01 wrote on Wednesday, August 03, 2016:

The “MDTM” command is quite essential to FTP. It needs support for time & date in +FAT.
So unless you have a good reason not to use it, I would enable it in your FreeRTOSFATConfig.h:

#define ffconfigTIME_SUPPORT      1

and also include the source file “ff_time.c”.

Regards

rasty1 wrote on Wednesday, August 03, 2016:

I have several reasons why I try to remove it

  1. I do not have RTC
  2. I was trying to optimize footprint
  3. I had the impresion that some “time” stuff drawn in from glibc. But I’m not sure.

heinbali01 wrote on Thursday, August 04, 2016:

I do not have RTC

But you dohave NTP :slight_smile:
What I often do is synchronise with NTP and use FreeRTOS to maintain the real time.

I was trying to optimize footprint

I’m not sure if it saves a lot of code. Have you calculated that?

I had the impression that some “time” stuff drawn in from glibc. But I’m not sure.

Not that I’m aware off. Several time-functions have been rewritten in order make it independent from the libraries provided by the compiler.

Now if you insist on not using time-support, I (or you) could make a change, remove the MDTM line from:

    static const char pcFeatAnswer[] =
        "211-Features:\x0a"
#if( ffconfigTIME_SUPPORT != 0 )
        "MDTM\x0a"
#endif
        " REST STREAM\x0a"
        " SIZE\x0d\x0a"
        "211 End\x0d\x0a";

and also:

	#if ffconfigTIME_SUPPORT == 0
	{
		xLength = snprintf( pcCOMMAND_BUFFER,
			sizeof( pcCOMMAND_BUFFER ),
			"213 19700101000000\r\n");
	}
	#else
	{
		  // return the time
	}
	#endif

Regards.