Date and time of a directory just created with MFS

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Date and time of a directory just created with MFS

跳至解决方案
1,550 次查看
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,321 次查看
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,322 次查看
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,321 次查看
jpderyck
Contributor II

Thank you Mister Daniel chen,

that's the solution I was looking for

best regards

Jean-Paul Deryck

0 项奖励
回复
1,321 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi JP

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

pastedImage_1.png

Regards

Daniel

0 项奖励
回复