From: Florent Kermarrec Date: Tue, 11 Feb 2020 16:16:24 +0000 (+0100) Subject: soc/integration/common: simplify get_version X-Git-Tag: 24jan2021_ls180~679 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0a737cb6249d6bef1082f0eeb43b724021e9c6b5;p=litex.git soc/integration/common: simplify get_version --- diff --git a/litex/soc/integration/common.py b/litex/soc/integration/common.py index a5ac066a..b43e8dfe 100644 --- a/litex/soc/integration/common.py +++ b/litex/soc/integration/common.py @@ -20,12 +20,8 @@ def mem_decoder(address, size=0x10000000): return lambda a: (a[log2_int(size):] == (address >> log2_int(size))) def get_version(with_time=True): - if with_time: - return datetime.datetime.fromtimestamp( - time.time()).strftime("%Y-%m-%d %H:%M:%S") - else: - return datetime.datetime.fromtimestamp( - time.time()).strftime("%Y-%m-%d") + fmt = "%Y-%m-%d %H:%M:%S" if with_time else "%Y-%m-%d" + return datetime.datetime.fromtimestamp(time.time()).strftime(fmt) def get_mem_data(filename_or_regions, endianness="big", mem_size=None): # create memory regions