Date and time of a directory just created with MFS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Date and time of a directory just created with MFS

Jump to solution
721 Views
jpderyck
Contributor II

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

Labels (2)
1 Solution
492 Views
danielchen
NXP TechSupport
NXP TechSupport

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

View solution in original post

3 Replies
493 Views
danielchen
NXP TechSupport
NXP TechSupport

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

492 Views
jpderyck
Contributor II

Thank you Mister Daniel chen,

that's the solution I was looking for

best regards

Jean-Paul Deryck

0 Kudos
492 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi JP

Yes, I think you can get the handle with  an fopen

pastedImage_1.png

Regards

Daniel

0 Kudos