RPKI Engine 1.0
Public Member Functions | Static Public Attributes

rpki.sundial.timedelta Class Reference

Inheritance diagram for rpki.sundial.timedelta:
Inheritance graph
Collaboration diagram for rpki.sundial.timedelta:
Collaboration graph

List of all members.

Public Member Functions

def __abs__
def __add__
def __div__
def __floordiv__
def __mul__
def __neg__
def __pos__
def __radd__
def __rdiv__
def __rfloordiv__
def __rmul__
def __rsub__
def __sub__
def convert_to_seconds
def fromtimedelta
def parse

Static Public Attributes

tuple regexp
 Hideously ugly regular expression to parse the complex text form.
int years_to_seconds = 31556926
 Conversion factor from years to seconds (value furnished by the "units" program).

Detailed Description

Timedelta with text parsing.  This accepts two input formats:

- A simple integer, indicating a number of seconds.

- A string of the form "uY vW wD xH yM zS" where u, v, w, x, y, and z
  are integers and Y, W, D, H, M, and S indicate years, weeks, days,
  hours, minutes, and seconds.  All of the fields are optional, but
  at least one must be specified.  Eg,"3D4H" means "three days plus
  four hours".

There is no "months" format, because the definition of a month is too
fuzzy to be useful (what day is six months from August 30th?)

Similarly, the "years" conversion may produce surprising results, as
"one year" in conventional English does not refer to a fixed interval
but rather a fixed (and in some cases undefined) offset within the
Gregorian calendar (what day is one year from February 29th?)  1Y as
implemented by this code refers to a specific number of seconds.
If you mean 365 days or 52 weeks, say that instead.

Definition at line 197 of file sundial.py.


Member Function Documentation

def rpki.sundial.timedelta.__abs__ (   self)

Definition at line 276 of file sundial.py.

def rpki.sundial.timedelta.__add__ (   self,
  x 
)

Definition at line 277 of file sundial.py.

def rpki.sundial.timedelta.__div__ (   self,
  x 
)

Definition at line 278 of file sundial.py.

def rpki.sundial.timedelta.__floordiv__ (   self,
  x 
)

Definition at line 279 of file sundial.py.

def rpki.sundial.timedelta.__mul__ (   self,
  x 
)

Definition at line 280 of file sundial.py.

def rpki.sundial.timedelta.__neg__ (   self)

Definition at line 281 of file sundial.py.

def rpki.sundial.timedelta.__pos__ (   self)

Definition at line 282 of file sundial.py.

def rpki.sundial.timedelta.__radd__ (   self,
  x 
)

Definition at line 283 of file sundial.py.

def rpki.sundial.timedelta.__rdiv__ (   self,
  x 
)

Definition at line 284 of file sundial.py.

def rpki.sundial.timedelta.__rfloordiv__ (   self,
  x 
)

Definition at line 285 of file sundial.py.

def rpki.sundial.timedelta.__rmul__ (   self,
  x 
)

Definition at line 286 of file sundial.py.

def rpki.sundial.timedelta.__rsub__ (   self,
  x 
)

Definition at line 287 of file sundial.py.

def rpki.sundial.timedelta.__sub__ (   self,
  x 
)

Definition at line 288 of file sundial.py.

def rpki.sundial.timedelta.convert_to_seconds (   self)
Convert a timedelta interval to seconds.

Definition at line 263 of file sundial.py.

def rpki.sundial.timedelta.fromtimedelta (   cls,
  x 
)
Convert a datetime.timedelta object into this subclass.

Definition at line 270 of file sundial.py.

def rpki.sundial.timedelta.parse (   cls,
  arg 
)
Parse text into a timedelta object.

Definition at line 242 of file sundial.py.


Member Data Documentation

Initial value:
re.compile("\\s*".join(("^",
                                   "(?:(?P<years>\\d+)Y)?",
                                   "(?:(?P<weeks>\\d+)W)?",
                                   "(?:(?P<days>\\d+)D)?",
                                   "(?:(?P<hours>\\d+)H)?",
                                   "(?:(?P<minutes>\\d+)M)?",
                                   "(?:(?P<seconds>\\d+)S)?",
                                   "$")),
                      re.I)

Hideously ugly regular expression to parse the complex text form.

Tags are intended for use with re.MatchObject.groupdict() and map directly to the keywords expected by the timedelta constructor.

Definition at line 225 of file sundial.py.

Conversion factor from years to seconds (value furnished by the "units" program).

Definition at line 239 of file sundial.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables