Skip to content
Browse files

Fix git-timecard to respect time zones.

So committing at 8h00 at -0700 punches the same slot as 08h00 at +0200.
  • Loading branch information...
1 parent a7d3d85 commit bd5abdadb6294d8c823b6b2e02095312d9dcdf1a @rosslagerwall committed with dustin Mar 17, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 gitaggregates.py
View
7 gitaggregates.py
@@ -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):

0 comments on commit bd5abda

Please sign in to comment.
Something went wrong with that request. Please try again.