diff options
Diffstat (limited to 'fs/isofs/util.c')
| -rw-r--r-- | fs/isofs/util.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/fs/isofs/util.c b/fs/isofs/util.c index 01e1ee7a998b..005a15cfd30a 100644 --- a/fs/isofs/util.c +++ b/fs/isofs/util.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | * linux/fs/isofs/util.c | 2 | * linux/fs/isofs/util.c |
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | #include <linux/time.h> | ||
| 5 | #include "isofs.h" | 6 | #include "isofs.h" |
| 6 | 7 | ||
| 7 | /* | 8 | /* |
| @@ -17,9 +18,9 @@ | |||
| 17 | int iso_date(char * p, int flag) | 18 | int iso_date(char * p, int flag) |
| 18 | { | 19 | { |
| 19 | int year, month, day, hour, minute, second, tz; | 20 | int year, month, day, hour, minute, second, tz; |
| 20 | int crtime, days, i; | 21 | int crtime; |
| 21 | 22 | ||
| 22 | year = p[0] - 70; | 23 | year = p[0]; |
| 23 | month = p[1]; | 24 | month = p[1]; |
| 24 | day = p[2]; | 25 | day = p[2]; |
| 25 | hour = p[3]; | 26 | hour = p[3]; |
| @@ -31,18 +32,7 @@ int iso_date(char * p, int flag) | |||
| 31 | if (year < 0) { | 32 | if (year < 0) { |
| 32 | crtime = 0; | 33 | crtime = 0; |
| 33 | } else { | 34 | } else { |
| 34 | int monlen[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; | 35 | crtime = mktime64(year+1900, month, day, hour, minute, second); |
| 35 | |||
| 36 | days = year * 365; | ||
| 37 | if (year > 2) | ||
| 38 | days += (year+1) / 4; | ||
| 39 | for (i = 1; i < month; i++) | ||
| 40 | days += monlen[i-1]; | ||
| 41 | if (((year+2) % 4) == 0 && month > 2) | ||
| 42 | days++; | ||
| 43 | days += day - 1; | ||
| 44 | crtime = ((((days * 24) + hour) * 60 + minute) * 60) | ||
| 45 | + second; | ||
| 46 | 36 | ||
| 47 | /* sign extend */ | 37 | /* sign extend */ |
| 48 | if (tz & 0x80) | 38 | if (tz & 0x80) |
