From bd6278a3054a0d57a34b849b59f8a20412a70cc7 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 15 Aug 2019 14:41:40 +1000 Subject: [PATCH] wacom: change the raw log file name to include the timestamp Because it's annoying when there's an issue with the timestamp in the file and you have to grep for the file name. And while we're there, change the human readable date to be actually readable. Signed-off-by: Peter Hutterer --- tuhi/wacom.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 7816ca8..bb428e3 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -209,14 +209,15 @@ class DataLogger(object): if self.logfile is not None: return - timestamp = time.strftime('%Y%m%d-%H%M%S') - fname = f'log-{timestamp}.yaml' + timestamp = int(time.time()) + t = time.strftime('%Y-%m-%d-%H:%M:%S') + fname = f'log-{timestamp}-{t}.yaml' path = os.path.join(self.logdir, fname) self.logfile = open(path, 'w+') self.logfile.write(f'name: {self.device.name}\n') self.logfile.write(f'bluetooth: {self.btaddr}\n') - self.logfile.write(f'time: {int(time.time())} # host time: {time.strftime("%Y-%m-%d %H:%M:%S")}\n') + self.logfile.write(f'time: {timestamp} # host time: {time.strftime("%Y-%m-%d %H:%M:%S")}\n') self.logfile.write(f'data:\n') def _close_file(self):