diff -r 996bb6fea7dd -r b6311a17471a eric7/MicroPython/MicroPythonFileSystemUtilities.py --- a/eric7/MicroPython/MicroPythonFileSystemUtilities.py Fri Feb 18 17:44:19 2022 +0100 +++ b/eric7/MicroPython/MicroPythonFileSystemUtilities.py Sun Feb 20 16:25:22 2022 +0100 @@ -11,16 +11,24 @@ import stat import os +MPY_EPOCH = time.mktime((2000, 1, 1, 0, 0, 0, 0, 1, -1)) +# MPy epoch is 2000-01-01 0:0:0 UTC -def mtime2string(mtime): + +def mtime2string(mtime, adjustEpoch=False): """ Function to convert a time value to a string representation. @param mtime time value @type int + @param adjustEpoch flag indicating to adjust the time for the difference + of the MPy epoch (defaults to False) + @type bool (optional) @return string representation of the given time @rtype str """ + if adjustEpoch: + mtime += MPY_EPOCH return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(mtime))