rpki.sundial.timedelta Class Reference

Inherits pydatetime::timedelta.

List of all members.

Public Member Functions

def convert_to_seconds
def fromtimedelta
def parse

Static Public Attributes

tuple regexp
 Hideously ugly regular expression to parse the complex text form.


Detailed Description

Timedelta with text parsing.  This accepts two input formats:

- A simple integer, indicating a number of seconds.

- A string of the form "wD xH yM zS" where w, x, y, and z are integers
  and D, H, M, and S indicate 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".

Definition at line 174 of file sundial.py.


Member Function Documentation

def rpki.sundial.timedelta.convert_to_seconds (   self  ) 

Convert a timedelta interval to seconds.

Definition at line 216 of file sundial.py.

def rpki.sundial.timedelta.fromtimedelta (   cls,
  x 
)

Convert a datetime.timedelta object into this subclass.

Definition at line 221 of file sundial.py.

def rpki.sundial.timedelta.parse (   cls,
  arg 
)

Parse text into a timedelta object.

Definition at line 200 of file sundial.py.


Member Data Documentation

Initial value:

re.compile("\\s*".join(("^",
                                   "(?:(?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 191 of file sundial.py.


The documentation for this class was generated from the following file:

Generated on Tue Jul 7 16:04:42 2009 for RPKI Engine by  doxygen 1.5.9