Back to index

moin  1.9.0~rc2
Functions
MoinMoin.util.timefuncs Namespace Reference

Functions

def tmtuple
def formathttpdate
def W3CDate

Function Documentation

def MoinMoin.util.timefuncs.formathttpdate (   tmsecs = None)
Return a HTTP date/time stamp as defined in
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3 .

Definition at line 23 of file timefuncs.py.

00023 
00024 def formathttpdate(tmsecs=None):
00025     """ Return a HTTP date/time stamp as defined in
00026         http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3 .
00027     """
00028     stamp = formatdate(tmsecs, False)
00029     # replace non-standard "-0000" at end with http-mandated "GMT"
00030     stamp = re.match('^(.*) [\-\+]0000$', stamp).group(1) + " GMT"
00031     return stamp

def MoinMoin.util.timefuncs.tmtuple (   tmsecs = None)
Return a time tuple.

    This is currently an alias for gmtime(), but allows later tweaking.

Definition at line 13 of file timefuncs.py.

00013 
00014 def tmtuple(tmsecs=None):
00015     """ Return a time tuple.
00016 
00017         This is currently an alias for gmtime(), but allows later tweaking.
00018     """
00019     # avoid problems due to timezones etc. - especially a underflow
00020     if -86400 <= tmsecs <= 86400: # if we are around 0, we maybe had
00021         tmsecs = 0                # 0 initially, so reset it to 0.
00022     return time.gmtime(tmsecs or time.time())

def MoinMoin.util.timefuncs.W3CDate (   tmsecs = None)
Return UTC time string according to http://www.w3.org/TR/NOTE-datetime

Definition at line 32 of file timefuncs.py.

00032 
00033 def W3CDate(tmsecs=None):
00034     """ Return UTC time string according to http://www.w3.org/TR/NOTE-datetime
00035     """
00036     if not tmsecs:
00037         tmsecs = time.gmtime()
00038     return time.strftime("%Y-%m-%dT%H:%M:%S", tmsecs) + "Z"
00039