Hello,
I use MQX 4.1 and a custom board based on a K64 with a USB host.
When I create a directory on a USB memory key mounted with MFS and I look at the result reading the key under windows, I see the correct directory but with no date and time.
Is it possible to specify a date and time with an ioctl IO_IOCTL_SET_DATE_TIME but for that we need a file ptr on the directory, how get it, with a fopen ?
thanks for help
JP
Solved! Go to Solution.
Hi JP
One customer solved this by _time_set / _time_get.
MFS already tries to write the date based on _time_get. If you synchronise the systems tick with the real time it should all work.
//Synchronise systems clock to real time clock
rtc_datetime_t datetime;
RTC_DRV_GetDatetime( FSL_RTCTIMER1, &datetime );
DATE_STRUCT date;
TIME_STRUCT time;
date.YEAR = datetime.year;
date.MONTH = datetime.month;
date.DAY = datetime.day;
date.HOUR = datetime.hour;
date.SECOND = datetime.second;
date.MILLISEC = 0;
_time_from_date(&date, &time);
_time_set(&time);
Regards
Daniel
Hi JP
One customer solved this by _time_set / _time_get.
MFS already tries to write the date based on _time_get. If you synchronise the systems tick with the real time it should all work.
//Synchronise systems clock to real time clock
rtc_datetime_t datetime;
RTC_DRV_GetDatetime( FSL_RTCTIMER1, &datetime );
DATE_STRUCT date;
TIME_STRUCT time;
date.YEAR = datetime.year;
date.MONTH = datetime.month;
date.DAY = datetime.day;
date.HOUR = datetime.hour;
date.SECOND = datetime.second;
date.MILLISEC = 0;
_time_from_date(&date, &time);
_time_set(&time);
Regards
Daniel
Thank you Mister Daniel chen,
that's the solution I was looking for
best regards
Jean-Paul Deryck
Hi JP
Yes, I think you can get the handle with an fopen
Regards
Daniel