CAT-SOOP API: catsoop.time
Members
-
catsoop.time.days (
list)List used for mapping weekday numbers to weekday letters
-
catsoop.time.detailed_timestamp (
function, lines 136-147)Generate a detailed timestamp. (e.g.
"2013-06-05:14:58:21.024717")Parameters:
time: an instance ofdatetime.datetime
Returns: a string containing a representation of the given time
-
catsoop.time.from_detailed_timestamp (
function, lines 150-161)Generate an instance of datetime from a detailed timestamp.
Parameters:
time: a string of the same form as the output fromcatsoop.time.detailed_timestamp
Returns: a
datetime.datetimeinstance representing the given time
-
catsoop.time.long_timestamp (
function, lines 106-118)Generate a (long) human-readable timestamp (e.g.,
"Wednesday June 05, 2013; 02:58:21 PM")Parameters:
time: an instance ofdatetime.datetime
Returns: a string containing a human-readable representation of the given time
-
catsoop.time.now (
function, lines 97-103)Wraps datetime.now.
Returns: the current time, as an instance of
datetime.datetime
-
catsoop.time.realize_time (
function, lines 27-81)Return an appropriate
datetime.datetimeobject based on the given timestring.The timestring can have one of the following forms:
'NEVER': resolves to the maximum date thatdatetimecan represent'ALWAYS': resolves to the minimum date that `datetime can represent'YYYY-MM-DD:HH:MM'resolves to a particular time (minute resolution)'W:HH:MM, whereWis a letter representing a day of the week, resolves to the given time in the week number given bycs_week_number, starting fromcs_first_monday. For example,'T:09:00'represents Tuesday morning at 9 o'clock.
Parameters:
context: the context associated with this request (from whichcs_first_mondayandcs_week_numberare read)timestring: a string representing the desired time (see above)
Returns: a
datetime.datetimeobject corresponding to the time given bytimestring
-
catsoop.time.short_timestamp (
function, lines 121-133)Generate a (short) human-readable timestamp (e.g.
"Jun 05, 2013; 02:58 PM")Parameters:
time: an instance ofdatetime.datetime
Returns: a string containing a human-readable representation of the given time
-
catsoop.time.unix (
function, lines 84-94)Generate a Unix timestamp from an instance of datetime.
Parameters:
dt: an instance ofdatetime.datetime
Returns: the Unix timestamp corresponding to the given time