b.timestamp : module documentation

Part of bzrlib

No module docstring
Function format_highres_date Format a date, such that it includes higher precision in the
Function unpack_highres_date This takes the high-resolution date stamp, and
Function format_patch_date Format a POSIX timestamp and optional offset as a patch-style date.
Function parse_patch_date Parse a patch-style date into a POSIX timestamp and offset.
def format_highres_date(t, offset=0):

Format a date, such that it includes higher precision in the seconds field.

Example: format_highres_date(time.time(), -time.timezone) this will return a date stamp for right now, formatted for the local timezone.

>>> from bzrlib.osutils import format_date
>>> format_date(1120153132.350850105, 0)
'Thu 2005-06-30 17:38:52 +0000'
>>> format_highres_date(1120153132.350850105, 0)
'Thu 2005-06-30 17:38:52.350850105 +0000'
>>> format_date(1120153132.350850105, -5*3600)
'Thu 2005-06-30 12:38:52 -0500'
>>> format_highres_date(1120153132.350850105, -5*3600)
'Thu 2005-06-30 12:38:52.350850105 -0500'
>>> format_highres_date(1120153132.350850105, 7200)
'Thu 2005-06-30 19:38:52.350850105 +0200'
>>> format_highres_date(1152428738.867522, 19800)
'Sun 2006-07-09 12:35:38.867522001 +0530'
ParameterstThe local time in fractional seconds since the epoch (type: float)
offsetThe timezone offset in integer seconds (type: int)
def unpack_highres_date(date):
This takes the high-resolution date stamp, and converts it back into the tuple (timestamp, timezone) Where timestamp is in real UTC since epoch seconds, and timezone is an integer number of seconds offset.
ParametersdateA date formated by format_highres_date (type: string)
def format_patch_date(secs, offset=0):
Format a POSIX timestamp and optional offset as a patch-style date.

Inverse of parse_patch_date.

def parse_patch_date(date_str):
Parse a patch-style date into a POSIX timestamp and offset.

Inverse of format_patch_date.

API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.