Skip to content

Commit

Permalink
Add timestamps to text output files
Browse files Browse the repository at this point in the history
  • Loading branch information
MBartkowiakSTFC committed Mar 7, 2024
1 parent 2bb55e6 commit 21fb52b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MDANSE/Src/MDANSE/Framework/Formats/TextFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import io
import tarfile
import codecs
import time

import numpy as np

Expand Down Expand Up @@ -68,6 +69,7 @@ def write(cls, filename, data, header=""):
real_buffer.seek(0)
info = tarfile.TarInfo(name="jobinfo.txt")
info.size = length_stringio(real_buffer)
info.mtime = time.time()
tf.addfile(tarinfo=info, fileobj=real_buffer)

for var in list(data.values()):
Expand All @@ -80,6 +82,7 @@ def write(cls, filename, data, header=""):

info = tarfile.TarInfo(name="%s%s" % (var.varname, cls.extensions[0]))
info.size = length_stringio(real_buffer)
info.mtime = time.time()
tf.addfile(tarinfo=info, fileobj=real_buffer)

tf.close()
Expand Down

0 comments on commit 21fb52b

Please sign in to comment.