#!/usr/bin/python
import os.path, time, re, datetime

fileName = 'filesystem_clock_test.txt';
f = open(fileName, 'w')
f.close()
clockNow = datetime.datetime.now()
fileNow = time.ctime(os.path.getctime(fileName))
fileMatch = re.search(':(\d+):(\d+)', fileNow)
print("clock time: {}".format(clockNow))
print("file time : {}".format(fileNow))
print("filesystem lag: {} s".format(clockNow.minute*60+clockNow.second -  (int(fileMatch.group(1))*60+int(fileMatch.group(2)))) )
os.remove(fileName)
