On Fri, Jan 17, 2020 at 3:59 AM Namjae Jeon <namjae.jeon@xxxxxxxxxxx> wrote: > > > > This is what I think the timezone mount option should be used > > for: if we don't know what the timezone was for the on-disk timestamp, use > > the one provided by the user. However, if none was specified, it should be > > either sys_tz or UTC (i.e. no conversion). I would prefer the use of UTC > > here given the problems with sys_tz, but sys_tz would be more consistent > > with how fs/fat works. > Hi Arnd, > > Could you please review this change ? Looks all good to me now. Arnd > /* Convert a EXFAT time/date pair to a UNIX date (seconds since 1 1 70). */ > void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, > __le16 time, __le16 date, u8 tz) > { > u16 t = le16_to_cpu(time); > u16 d = le16_to_cpu(date); > > ts->tv_sec = mktime64(1980 + (d >> 9), d >> 5 & 0x000F, d & 0x001F, > t >> 11, (t >> 5) & 0x003F, (t & 0x001F) << 1); > ts->tv_nsec = 0; > > if (tz & EXFAT_TZ_VALID) > /* Adjust timezone to UTC0. */ > exfat_adjust_tz(ts, tz & ~EXFAT_TZ_VALID); > else > /* Convert from local time to UTC using time_offset. */ > ts->tv_sec -= sbi->options.time_offset * SECS_PER_MIN; > } > > /* Convert linear UNIX date to a EXFAT time/date pair. */ > void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts, > __le16 *time, __le16 *date, u8 *tz) > { > struct tm tm; > u16 t, d; > > time64_to_tm(ts->tv_sec, 0, &tm); > t = (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); > d = ((tm.tm_year - 80) << 9) | ((tm.tm_mon + 1) << 5) | tm.tm_mday; > > *time = cpu_to_le16(t); > *date = cpu_to_le16(d); > > /* > * Record 00h value for OffsetFromUtc field and 1 value for OffsetValid > * to indicate that local time and UTC are the same. > */ > *tz = EXFAT_TZ_VALID; > } > > Thanks! >