Ticket #9524: 0001-iso9660-fat-and-exfat-fs-add-ons-corrects-time-conve.patch

File 0001-iso9660-fat-and-exfat-fs-add-ons-corrects-time-conve.patch, 2.4 KB (added by beos_zealot, 7 years ago)
  • src/add-ons/kernel/file_systems/exfat/Inode.cpp

    From 9f146e89fc80437626924e0b143bcaa88a83739a Mon Sep 17 00:00:00 2001
    From: Gediminas Jarulaitis <beos.zealot@gmail.com>
    Date: Sun, 17 Mar 2013 16:44:07 +0200
    Subject: [PATCH] [iso9660, fat and exfat fs add-ons] corrects time convertion
     mistakes. Fixes #9524
    
    ---
     src/add-ons/kernel/file_systems/exfat/Inode.cpp     |    2 +-
     src/add-ons/kernel/file_systems/fat/util.c          |    4 ++--
     src/add-ons/kernel/file_systems/iso9660/iso9660.cpp |    2 +-
     3 files changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/src/add-ons/kernel/file_systems/exfat/Inode.cpp b/src/add-ons/kernel/file_systems/exfat/Inode.cpp
    index a03c13c..db90fb3 100644
    a b Inode::_GetTimespec(uint16 date, uint16 time, struct timespec &timespec) const  
    271271
    272272    time_t days = daze[(date>>5)&15] + ((date>>9)+10)*365 + leaps((date>>9)+10,((date>>5)&15)-1)+(date&31)-1;
    273273
    274     timespec.tv_sec = ((days * 24 + (time >> 11)) * 60 + ((time>>5)&63) + tzoffset) * 60 + 2*(time&31);
     274    timespec.tv_sec = ((days * 24 + (time >> 11)) * 60 + ((time>>5)&63) - tzoffset) * 60 + 2*(time&31);
    275275    timespec.tv_nsec = 0;
    276276}
    277277
  • src/add-ons/kernel/file_systems/fat/util.c

    diff --git a/src/add-ons/kernel/file_systems/fat/util.c b/src/add-ons/kernel/file_systems/fat/util.c
    index d5114f7..7bab5e3 100644
    a b dos2time_t(uint32 t)  
    106106
    107107    days = daze[(t>>21)&15] + ((t>>25)+10)*365 + leaps((t>>25)+10,((t>>21)&15)-1)+((t>>16)&31)-1;
    108108
    109     return (((days * 24) + ((t>>11)&31)) * 60 + ((t>>5)&63) + tzoffset) * 60 + 2*(t&31);
     109    return (((days * 24) + ((t>>11)&31)) * 60 + ((t>>5)&63) - tzoffset) * 60 + 2*(t&31);
    110110}
    111111
    112112
    time_t2dos(time_t s)  
    118118
    119119    get_tzoffset();
    120120
    121     t = (s % 60) / 2;   s /= 60; s -= tzoffset;
     121    t = (s % 60) / 2;   s /= 60; s += tzoffset;
    122122    t += (s % 60) << 5; s /= 60;
    123123    t += (s % 24) << 11;s /= 24;
    124124
  • src/add-ons/kernel/file_systems/iso9660/iso9660.cpp

    diff --git a/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp b/src/add-ons/kernel/file_systems/iso9660/iso9660.cpp
    index c66ae29..44ba3a9 100644
    a b ConvertRecDate(ISORecDate* inDate, time_t* outDate)  
    10021002            tz |= (-1 << 8);
    10031003
    10041004        if (-48 <= tz && tz <= 52)
    1005             time += tz *15 * 60;
     1005            time -= tz *15 * 60;
    10061006    }
    10071007    *outDate = time;
    10081008    return 0;