--- linux-4.9.37/fs/fat/misc.c 2017-07-12 16:42:41.000000000 +0300 +++ linux-4.9.y/fs/fat/misc.c 2021-06-07 13:01:34.000000000 +0300 @@ -261,6 +261,37 @@ *time_cs = (ts->tv_sec & 1) * 100 + ts->tv_nsec / 10000000; } EXPORT_SYMBOL_GPL(fat_time_unix2fat); +#ifdef CONFIG_GOKE_MC +void fat_time_fat2str(struct msdos_sb_info *sbi, char *d_createtime, + __le16 __time, __le16 __date, u8 time_cs) +{ + u16 time = le16_to_cpu(__time), date = le16_to_cpu(__date); + time_t day, month, year; + + year = date >> 9; + month = max(1, (date >> 5) & 0xf); + day = max(1, date & 0x1f) - 1; + + d_createtime[0] = year; + d_createtime[1] = month; + d_createtime[2] = day; + d_createtime[3] = (time >> 11); /*hour*/ + d_createtime[4] = ((time >> 5) & 0x3f); /*min*/ + d_createtime[5] = (time & 0x1f); /*second 2s*/ + + + if (!sbi->options.tz_set) + d_createtime[4] += sys_tz.tz_minuteswest; + else + d_createtime[4] -= sbi->options.time_offset; + + if (time_cs) { + /*second 1s*/ + d_createtime[5] += (time_cs / 100); + } +} +EXPORT_SYMBOL_GPL(fat_time_fat2str); +#endif int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs) {