Inherits pydatetime::timedelta.
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). |
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 168 of file sundial.py.
def rpki.sundial.timedelta.__abs__ | ( | self | ) |
Definition at line 243 of file sundial.py.
def rpki.sundial.timedelta.__add__ | ( | self, | ||
x | ||||
) |
Definition at line 244 of file sundial.py.
def rpki.sundial.timedelta.__div__ | ( | self, | ||
x | ||||
) |
Definition at line 245 of file sundial.py.
def rpki.sundial.timedelta.__floordiv__ | ( | self, | ||
x | ||||
) |
Definition at line 246 of file sundial.py.
def rpki.sundial.timedelta.__mul__ | ( | self, | ||
x | ||||
) |
Definition at line 247 of file sundial.py.
def rpki.sundial.timedelta.__neg__ | ( | self | ) |
Definition at line 248 of file sundial.py.
def rpki.sundial.timedelta.__pos__ | ( | self | ) |
Definition at line 249 of file sundial.py.
def rpki.sundial.timedelta.__radd__ | ( | self, | ||
x | ||||
) |
Definition at line 250 of file sundial.py.
def rpki.sundial.timedelta.__rdiv__ | ( | self, | ||
x | ||||
) |
Definition at line 251 of file sundial.py.
def rpki.sundial.timedelta.__rfloordiv__ | ( | self, | ||
x | ||||
) |
Definition at line 252 of file sundial.py.
def rpki.sundial.timedelta.__rmul__ | ( | self, | ||
x | ||||
) |
Definition at line 253 of file sundial.py.
def rpki.sundial.timedelta.__rsub__ | ( | self, | ||
x | ||||
) |
Definition at line 254 of file sundial.py.
def rpki.sundial.timedelta.__sub__ | ( | self, | ||
x | ||||
) |
Definition at line 255 of file sundial.py.
def rpki.sundial.timedelta.convert_to_seconds | ( | self | ) |
Convert a timedelta interval to seconds.
Definition at line 234 of file sundial.py.
def rpki.sundial.timedelta.fromtimedelta | ( | cls, | ||
x | ||||
) |
Convert a datetime.timedelta object into this subclass.
Definition at line 239 of file sundial.py.
def rpki.sundial.timedelta.parse | ( | cls, | ||
arg | ||||
) |
Parse text into a timedelta object.
Definition at line 213 of file sundial.py.
rpki::sundial.timedelta::regexp [static] |
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 196 of file sundial.py.
rpki::sundial.timedelta::years_to_seconds = 31556926 [static] |
Conversion factor from years to seconds (value furnished by the "units" program).
Definition at line 210 of file sundial.py.