Date and time of a directory just created with MFS

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Date and time of a directory just created with MFS

ソリューションへジャンプ
1,547件の閲覧回数
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

ラベル(2)
1 解決策
1,318件の閲覧回数
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

元の投稿で解決策を見る

3 返答(返信)
1,319件の閲覧回数
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

1,318件の閲覧回数
jpderyck
Contributor II

Thank you Mister Daniel chen,

that's the solution I was looking for

best regards

Jean-Paul Deryck

0 件の賞賛
返信
1,318件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi JP

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

pastedImage_1.png

Regards

Daniel

0 件の賞賛
返信