Changeset 798:ff1b73253239


Ignore:
Timestamp:
May 10, 2009, 12:21:38 PM (12 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Convert:
svn:778c30c8-61e0-0310-89d4-fe2f97a467b2/trunk@866
Message:
Fix handling of 12 AM and 12 PM times in the MS format parser.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • _test_ftp_stat.py

    r642 r798  
    1 # Copyright (C) 2003-2006, Stefan Schwarzer
     1# Copyright (C) 2003-2009, Stefan Schwarzer
    22# All rights reserved.
    33#
     
    152152          "07-27-01  11:16AM       <DIR>          Test",
    153153          "10-23-95  03:25PM       <DIR>          WindowsXP",
    154           "07-17-00  02:08PM             12266720 test.exe"
     154          "07-17-00  02:08PM             12266720 test.exe",
     155          "07-17-09  12:08AM             12266720 test.exe",
     156          "07-17-09  12:08PM             12266720 test.exe"
    155157          ]
    156158        expected_stat_results = [
     
    160162           (1995, 10, 23, 15, 25, 0), None],
    161163          [33024, None, None, None, None, None, 12266720, None,
    162            (2000, 7, 17, 14, 8, 0), None]
     164           (2000, 7, 17, 14, 8, 0), None],
     165          [33024, None, None, None, None, None, 12266720, None,
     166           (2009, 7, 17, 0, 8, 0), None],
     167          [33024, None, None, None, None, None, 12266720, None,
     168           (2009, 7, 17, 12, 8, 0), None]
    163169          ]
    164170        self._test_valid_lines(ftp_stat.MSParser, lines, expected_stat_results)
  • ftp_stat.py

    r771 r798  
    233233        except (ValueError, IndexError):
    234234            raise ftp_error.ParserError("invalid time string '%s'" % time_)
    235         if am_pm == 'P':
     235        if am_pm == 'A' and hour == 12:
     236            hour = 0
     237        if am_pm == 'P' and hour != 12:
    236238            hour = hour + 12
    237239        st_mtime = time.mktime( (year, month, day,
Note: See TracChangeset for help on using the changeset viewer.