We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I am using fatfs file system.
elm-chan.org/.../stat.html
I need to return fdate and ftime convert into 32 bit number
void netHTTPs_fstat (const char *fname, uint32_t *fsize, uint32_t *ftime) { *ftime = ?? }
Thanks, Naeem
Got the answer.
Here is working code __current_date and __current_time is my own structure. I set windows date and time on these structure. need some adjustment for C tm structure.
void netHTTPs_fstat (const char *fname, uint32_t *fsize, uint32_t *ftime) { FILINFO fno; FRESULT fr = f_stat(fname, &fno); if (fr == FR_OK) { *fsize = fno.fsize; tm time_stamp; time_stamp.tm_year = __current_date.year_ - 1900; // years since 1900 // months since January (0-11) time_stamp.tm_mon = __current_date.month_ - 1; time_stamp.tm_mday = __current_date.day_; time_stamp.tm_hour = __current_time.hour_; time_stamp.tm_min = __current_time.min_; time_stamp.tm_sec = __current_time.sec_; time_stamp.tm_isdst = false; *ftime = mktime(&time_stamp); } else { *ftime = 0; *fsize = 0; } #ifdef PRINTF_DEBUG printf("netHTTPs_fstat file_name='%s' size=%u\n", fname, *fsize); #endif }
Don't do that!
Names with leading underscores are reserved for the compiler!
You meant naming convention?