求助:FileSystem如何设置和获取文件的创建时间
我使用的是MDK-Middleware 7.12,FileSystem 6.13.8使用filesystem管理Nand,在创建文件时,使用了ftime_set()函数,但是,在使用ftime_get()函数时,发现读取出来的时间不正确
请问有使用过此功能的同仁吗?可以指导一二吗?
FileErrCode_t TeachingFile::creat(const char* fn)
{
fsFileInfo info{};
FILE* f = null;
FileList_t list = { 0 };
info.fileID = 0;
if (ffind(fn, &info) == fsOK)
{
return FILE_EXIST;
}
f = fopen(fn, "wb+");
if (f == null)
{
return FILE_ERROR;
}
else
{
char s[] = "test sting";
fwrite(s, sizeof(uint8_t), sizeof"test sting" - 1, f);
stat=fs_get_time(&time1);
stat=ftime_set(fn, &time1, &time1, &time1);
fclose(f);
info.fileID = 0;
stat=ftime_get(fn, &cTime, &aTime, &wTime);
ffind(fn, &info);
f = null;
strcpy(list.fn, fn);
list.size = 0;
// TODO: add fsTime
rtc.getTime(&list.time);
_fileList.push_back(&list);
}
return FILE_SUCCESS;
}
还没有测试过这个功能,回头试试。 期待硬汉兄。。。我这也是一个项目需要,才更新到这个middle版本,看文档说支持时间戳。结果测试时发现有些问题 这个。。好像解决了,它用的不是BCD码,RTC给出的是BCD码,需要做个转换。。。 adonzheng 发表于 2021-1-22 18:34
这个。。好像解决了,它用的不是BCD码,RTC给出的是BCD码,需要做个转换。。。
谢谢告知原因。
页:
[1]