diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2006-02-23 02:57:19 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2006-02-23 02:57:19 +0000 |
commit | 1f00040a3541728a517176d318f0c099a3f813c1 (patch) | |
tree | 5caecf363a4d135e779ff40e6cf6301abce5692e /rdiff-backup/rdiff_backup | |
parent | a8190e19465aacc659c246123213c53d7f562f28 (diff) | |
download | rdiff-backup-1f00040a3541728a517176d318f0c099a3f813c1.tar.gz |
Times like "Mon Jun 5 11:00:23 1997" now recognized
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@757 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup')
-rw-r--r-- | rdiff-backup/rdiff_backup/Time.py | 9 | ||||
-rw-r--r-- | rdiff-backup/rdiff_backup/compare.py | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/rdiff-backup/rdiff_backup/Time.py b/rdiff-backup/rdiff_backup/Time.py index 6481a58..7885332 100644 --- a/rdiff-backup/rdiff_backup/Time.py +++ b/rdiff-backup/rdiff_backup/Time.py @@ -96,6 +96,11 @@ def stringtopretty(timestring): """Return pretty version of time given w3 time string""" return timetopretty(stringtotime(timestring)) +def prettytotime(prettystring): + """Converts time like "Mon Jun 5 11:00:23" to epoch sec, or None""" + try: return time.mktime(time.strptime(prettystring)) + except ValueError: return None + def inttopretty(seconds): """Convert num of seconds to readable string like "2 hours".""" partlist = [] @@ -222,6 +227,10 @@ the day).""" % timestr) if _session_regexp.search(timestr): return time_from_session(int(timestr[:-1]), rp) + # Try for long time, like "Mon Jun 5 11:00:23 1990" + t = prettytotime(timestr) + if t is not None: return t + try: # test for an interval, like "2 days ago" return curtime - intstringtoseconds(timestr) except TimeException: pass diff --git a/rdiff-backup/rdiff_backup/compare.py b/rdiff-backup/rdiff_backup/compare.py index 892cf75..e9884ed 100644 --- a/rdiff-backup/rdiff_backup/compare.py +++ b/rdiff-backup/rdiff_backup/compare.py @@ -24,6 +24,7 @@ compare. This uses elements of the backup and restore modules. """ +from __future__ import generators import Globals, restore, rorpiter, log, backup, static, rpath, hash, robust def Compare(src_rp, mirror_rp, inc_rp, compare_time): |