Skip to content

Commit

Permalink
Fix git-timecard to respect time zones.
Browse files Browse the repository at this point in the history
So committing at 8h00 at -0700 punches the same slot as 08h00 at +0200.
  • Loading branch information
rosslagerwall authored and dustin committed Mar 19, 2012
1 parent a7d3d85 commit bd5abda
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gitaggregates.py
Expand Up @@ -14,12 +14,15 @@ def add_logs(self, directory=None, log_args=['HEAD']):
args=['git']
if directory:
args.append('--git-dir=' + directory)
args.extend(['log', '--pretty=format:%at'])
args.extend(['log', '--format=%ad', '--date=raw'])
args.extend(log_args)
sub = subprocess.Popen(args, stdout=subprocess.PIPE, close_fds=True)

for l in sub.stdout:
self.h[time.strftime("%w %H", time.localtime(float(l.strip())))] += 1
t, offset = l.strip().split(' ')
t = float(t) + int(offset) / 100 * 3600

self.h[time.strftime("%w %H", time.gmtime(t))] += 1

def dump(self):
for h in range(24):
Expand Down

0 comments on commit bd5abda

Please sign in to comment.