Package duplicity :: Module dup_time
[hide private]
[frames] | no frames]

Module dup_time

source code

Provide time related exceptions and functions

Classes [hide private]
  TimeException
Functions [hide private]
 
setcurtime(time_in_secs=None)
Sets the current time in curtime and curtimestr
source code
 
setprevtime(time_in_secs)
Sets the previous time in prevtime and prevtimestr
source code
 
timetostring(timeinseconds)
Return w3 or duplicity datetime compliant listing of timeinseconds
source code
 
stringtotime(timestring)
Return time in seconds from w3 or duplicity timestring
source code
 
timetopretty(timeinseconds)
Return pretty version of time
source code
 
stringtopretty(timestring)
Return pretty version of time given w3 time string
source code
 
inttopretty(seconds)
Convert num of seconds to readable string like "2 hours".
source code
 
intstringtoseconds(interval_string)
Convert a string expressing an interval (e.g.
source code
 
gettzd(dstflag)
Return w3's timezone identification string.
source code
 
tzdtoseconds(tzd)
Given w3 compliant TZD, return how far ahead UTC is
source code
 
cmp(time1, time2)
Compare time1 and time2 and return -1, 0, or 1
source code
 
genstrtotime(timestr, override_curtime=None)
Convert a generic time string to a time in seconds
source code
Variables [hide private]
  _interval_conv_dict = {"s": 1, "m": 60, "h": 3600, "D": 86400,...
  _integer_regexp = re.compile("^[0-9]+$")
  _interval_regexp = re.compile("^([0-9]+)([smhDWMY])")
  _genstr_date_regexp1 = re.compile("^(?P<year>[0-9]{4})[-/]" "(...
  _genstr_date_regexp2 = re.compile("^(?P<month>[0-9]{1,2})[-/]"...
  _genstr_date_regexp3 = re.compile("^(?P<year>[0-9]{4})" "(?P<m...
  curtimestr = None
hash(x)
  curtime = None
hash(x)
  prevtimestr = None
hash(x)
  prevtime = None
hash(x)
  bad_interval_string = _("""Bad interval string "...
  bad_time_string = _("""Bad time string "...
Function Details [hide private]

stringtotime(timestring)

source code 

Return time in seconds from w3 or duplicity timestring

If there is an error parsing the string, or it doesn't look like a valid datetime string, return None.

intstringtoseconds(interval_string)

source code 

Convert a string expressing an interval (e.g. "4D2s") to seconds

gettzd(dstflag)

source code 

Return w3's timezone identification string.

Expresed as [+/-]hh:mm. For instance, PST is -08:00. Zone is coincides with what localtime(), etc., use.


Variables Details [hide private]

_interval_conv_dict

Value:
{"s": 1, "m": 60, "h": 3600, "D": 86400, "W": 7* 86400, "M": 30* 86400\
, "Y": 365* 86400}

_genstr_date_regexp1

Value:
re.compile("^(?P<year>[0-9]{4})[-/]" "(?P<month>[0-9]{1,2})[-/]" "(?P<\
day>[0-9]{1,2})$")

_genstr_date_regexp2

Value:
re.compile("^(?P<month>[0-9]{1,2})[-/]" "(?P<day>[0-9]{1,2})[-/]" "(?P\
<year>[0-9]{4})$")

_genstr_date_regexp3

Value:
re.compile("^(?P<year>[0-9]{4})" "(?P<month>[0-9]{2})" "(?P<day>[0-9]{\
2})Z$")

bad_interval_string

Value:
_("""Bad interval string "%s"

Intervals are specified like 2Y (2 years) or 2h30m (2.5 hours).  The
allowed special characters are s, m, h, D, W, M, and Y.  See the man
page for more information.""")

bad_time_string

Value:
_("""Bad time string "%s"

The acceptible time strings are intervals (like "3D64s"), w3-datetime
strings, like "2002-04-26T04:22:01-07:00" (strings like
"2002-04-26T04:22:01" are also acceptable - duplicity will use the
current time zone), or ordinary dates like 2/4/1997 or 2001-04-23
(various combinations are acceptable, but the month always precedes
the day).""")