def epoch_to_datetime(seconds_from_epoch): """Convert seconds since 1970-1-1 (UNIX epoch) to a datetime""" # This doesnt work on windows for negative timestamps # http://stackoverflow.com/questions/22082103/on-windows-how-to-convert-a-timestamps-before-1970-into-something-manageable # return datetime.utcfromtimestamp(seconds_from_epoch) # but this should: if is_archaelogical(): return bcdate_util.epoch_to_bcdate(seconds_from_epoch) else: return datetime(1970, 1, 1) + timedelta(seconds=seconds_from_epoch)
def epoch_to_datetime(seconds_from_epoch): """Convert seconds since 1970-1-1 (UNIX epoch) to a datetime""" # This doesnt work on windows for negative timestamps # http://stackoverflow.com/questions/22082103/on-windows-how-to-convert-a-timestamps-before-1970-into-something-manageable # nopep8 # return datetime.utcfromtimestamp(seconds_from_epoch) # but this should: if is_archaelogical(): return bcdate_util.epoch_to_bcdate(seconds_from_epoch) else: return datetime(1970, 1, 1) + timedelta(seconds=seconds_from_epoch)