577977bff5a15a1709416d0be983632ee8a781c6
[blog.git] / posts / conky / emerge-lastsync.py
1 #!/usr/bin/python
2 #
3 # Based on
4 # http://conky.sourceforge.net/lastsync.pl
5
6 import time
7
8 syncs = []
9 for line in file('/var/log/emerge.log', 'r'):
10     if not 'Sync completed' in line:
11         continue
12     sync_time = int(line[:10])
13     syncs.append(sync_time)
14
15 print(time.strftime('%a, %b %e', time.localtime(syncs[-1])))