diff options
Diffstat (limited to 'fs/fat/misc.c')
| -rw-r--r-- | fs/fat/misc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 61f23511eacf..79fb98ad36d4 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c | |||
| @@ -142,7 +142,7 @@ static int day_n[] = { | |||
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | /* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */ | 144 | /* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */ |
| 145 | int date_dos2unix(unsigned short time, unsigned short date) | 145 | int date_dos2unix(unsigned short time, unsigned short date, int tz_utc) |
| 146 | { | 146 | { |
| 147 | int month, year, secs; | 147 | int month, year, secs; |
| 148 | 148 | ||
| @@ -156,16 +156,18 @@ int date_dos2unix(unsigned short time, unsigned short date) | |||
| 156 | ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 && | 156 | ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 && |
| 157 | month < 2 ? 1 : 0)+3653); | 157 | month < 2 ? 1 : 0)+3653); |
| 158 | /* days since 1.1.70 plus 80's leap day */ | 158 | /* days since 1.1.70 plus 80's leap day */ |
| 159 | secs += sys_tz.tz_minuteswest*60; | 159 | if (!tz_utc) |
| 160 | secs += sys_tz.tz_minuteswest*60; | ||
| 160 | return secs; | 161 | return secs; |
| 161 | } | 162 | } |
| 162 | 163 | ||
| 163 | /* Convert linear UNIX date to a MS-DOS time/date pair. */ | 164 | /* Convert linear UNIX date to a MS-DOS time/date pair. */ |
| 164 | void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date) | 165 | void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date, int tz_utc) |
| 165 | { | 166 | { |
| 166 | int day, year, nl_day, month; | 167 | int day, year, nl_day, month; |
| 167 | 168 | ||
| 168 | unix_date -= sys_tz.tz_minuteswest*60; | 169 | if (!tz_utc) |
| 170 | unix_date -= sys_tz.tz_minuteswest*60; | ||
| 169 | 171 | ||
| 170 | /* Jan 1 GMT 00:00:00 1980. But what about another time zone? */ | 172 | /* Jan 1 GMT 00:00:00 1980. But what about another time zone? */ |
| 171 | if (unix_date < 315532800) | 173 | if (unix_date < 315532800) |
