This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Set the Time and Date on a File or Directory Flash File System

Always I read 12:00:00 1/1/1980 using ffind.
I did not find a function fs_set_time or fs_set_date, somebody know how can I set the date, time , timestamp,etc... when I use fs_arm_l.lib with lpc2468?

  • Hi,
    there are functions fs_get_time and fs_get_date in fs_time.c which retrieve the current time/date for use in the flashFS.
    It is called by get_date in fs_fat.c which should set the right time/date in the FAT.

    Attention: You have to implement the functions fs_get_time and fs_get_date. By default there are just dummy implementations, which return a constant time/date.

  • Thank you Stefan. I made changes on fs_time.c, but I could recompile fs_arm_l.lib.

    U32 fs_get_time (void) {
       /* Return Current Time for FAT File Time stamp. */
       U32 h,m,s,time;
    
       h = RTC_HOUR;
       m = RTC_MIN;
       s = RTC_SEC;
    
       time = (h << 16) | (m << 8) | s;
       return (time);
    }
    
    
    /*--------------------------- fs_get_date -----------------------------------*/
    
    U32 fs_get_date (void) {
       /* Return Current Date for FAT File Time stamp. */
       U32 d,m,y,date;
    
       y=RTC_YEAR;
       m = RTC_MONTH;
       d = RTC_DAY;
    
       date = (y << 16) | (m << 8) | d;
       return (date);
    }
    
    


    do you know how can I do this, I try disable the _fs_time.o in fs_arm_l.lib and include fs_time.c in my project , but always return default values.

  • Hello Antonio Albuquerque,

    please check FlashFS online manual www.keil.com/.../rlarm_fs_cfgtimesup.htm.

    In this chapter it is explained how to add time support.

    Best Regards,
    Martin Guenther

  • I've added all the source files of flashFS to my project instead of the lib and thus all the changes I made were used.

  • Antonio,

    You need to write the function to set the RTC time. Then have the function call to bring in the time in these functions and set the variables from the values from your structure.

    U32 fs_get_time (void) { /* Return Current Time for FAT File Time stamp. */ U32 h,m,s,tme; tSimTime time;

    getSimTime(&time); h = time.hour; m = time.min; s = time.sec;

    tme = (h << 16) | (m << 8) | s; return (tme);
    }

    /*--------------------------- fs_get_date -----------------------------------*/

    U32 fs_get_date (void) { /* Return Current Date for FAT File Time stamp. */ U32 d,m,y,date; tSimTime time; getSimTime(&time); d = time.date; m = time.month; y = time.year+2000; date = (y << 16) | (m << 8) | d; return (date);
    }

    Something like this..

    Gud luck,
    Sivaram.