|
1 | 1 | import time |
2 | 2 | from collections import defaultdict, deque |
3 | | -from datetime import datetime |
| 3 | +from datetime import datetime, timezone |
4 | 4 | from typing import Optional |
5 | 5 |
|
6 | 6 | import pygit2 |
@@ -206,7 +206,7 @@ def map_symbols_to_history(self, force=False) -> None: |
206 | 206 | start_time = time.time() |
207 | 207 |
|
208 | 208 | print("Stashing any working directory changes...") |
209 | | - stash_msg = f"Codegen Attribution Stash @ {datetime.now().timestamp()}" |
| 209 | + stash_msg = f"Codegen Attribution Stash @ {datetime.now(timezone.utc).timestamp()}" |
210 | 210 | stash_id = None |
211 | 211 | try: |
212 | 212 | stash_id = self.repo.stash(self.repo.default_signature, stash_msg, include_untracked=True) |
@@ -423,12 +423,12 @@ def get_ai_contribution_timeline(self) -> list[tuple[datetime, int]]: |
423 | 423 | if any(name in author for name in self.ai_authors): |
424 | 424 | for commit in commits: |
425 | 425 | # Convert timestamp to year-month |
426 | | - dt = datetime.fromtimestamp(commit["timestamp"]) |
| 426 | + dt = datetime.fromtimestamp(commit["timestamp"], timezone.utc) |
427 | 427 | month_key = f"{dt.year}-{dt.month:02d}" |
428 | 428 | monthly_counts[month_key] += 1 |
429 | 429 |
|
430 | 430 | # Sort by date |
431 | 431 | timeline = sorted(monthly_counts.items()) |
432 | 432 |
|
433 | 433 | # Convert to datetime objects |
434 | | - return [(datetime.strptime(month, "%Y-%m"), count) for month, count in timeline] |
| 434 | + return [(datetime.strptime(month, "%Y-%m").replace(tzinfo=timezone.utc), count) for month, count in timeline] |
0 commit comments