----------------------------------------------------------------------------------------------------------
#!/usr/bin/python
import sys
import re
import time
import datetime
import fileinput
import os
try:
uptime = open('/proc/uptime','r')
except IOError as (errno, strerror):
print "Wystapil blad otwarcia pliku :\n %s\n" % (strerror)
czas = time.time()
uptime_seconds = czas-float(uptime.readline().split()[0])
p = os.popen('dmesg')
for line in p.readlines():
re1='.*?'
re2='(\\d+)'
re3='(\\.)'
re4='(\\d+)'
rg = re.compile(re1+re2+re3+re4,re.IGNORECASE|re.DOTALL)
m = rg.search(line)
if m:
int1=float(m.group(1)+m.group(2)+m.group(3))
szukaj=(m.group(1)+m.group(2)+m.group(3))
czas = uptime_seconds + int1
czas = datetime.datetime.fromtimestamp(int(czas)).strftime('%Y-%m-%d %H:%M:%S')
zwrot = re.sub(szukaj,czas,line.rstrip(),1)
print zwrot