From: Brian Warner Date: Fri, 13 Mar 2009 01:16:00 +0000 (-0700) Subject: tahoe_backup.py: tolerate more time formats X-Git-Tag: allmydata-tahoe-1.4.0~62 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/%22doc.html/?a=commitdiff_plain;h=809ec25ffaf5cc0ef605da13b41d025cf618cccd;p=tahoe-lafs%2Ftahoe-lafs.git tahoe_backup.py: tolerate more time formats --- diff --git a/src/allmydata/scripts/tahoe_backup.py b/src/allmydata/scripts/tahoe_backup.py index ee9ad120..b6e26441 100644 --- a/src/allmydata/scripts/tahoe_backup.py +++ b/src/allmydata/scripts/tahoe_backup.py @@ -44,6 +44,17 @@ def parse_old_timestamp(s, options): except ValueError: pass + try: + # "2008-11-16 10.34.56 PM" (localtime) + if s[-3:] in (" AM", " PM"): + # this might raise ValueError + when = time.strptime(s[:-3], "%Y-%m-%d %I.%M.%S") + if s[-3:] == "PM": + when += 12*60*60 + return when + except ValueError: + pass + try: # "2008-12-31 18.21.43" when = time.strptime(s, "%Y-%m-%d %H.%M.%S")