Skip to content

Commit

Permalink
Merge pull request #694 from dataquest-dev/internal/add-correct-timezone
Browse files Browse the repository at this point in the history
Update sourceversion.py
  • Loading branch information
vidiecan authored Aug 27, 2024
2 parents b4adbad + 6d9c8b1 commit f59b077
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions scripts/sourceversion.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import subprocess
import sys
from datetime import datetime
from datetime import datetime, timezone

def get_time_in_timezone(zone: str = "Europe/Bratislava"):
try:
from zoneinfo import ZoneInfo
my_tz = ZoneInfo(zone)
except Exception as e:
my_tz = timezone.utc
return datetime.now(my_tz)


if __name__ == '__main__':
ts = datetime.now()
print(f"This info was generated on: {ts}")
ts = get_time_in_timezone()
print(f"This info was generated on: {ts.strftime('%Y-%m-%d %H:%M:%S %Z%z')}")

cmd = 'git log -1 --pretty=format:"Git hash: %H Date of commit: %ai"'
subprocess.check_call(cmd, shell=True)
Expand Down

0 comments on commit f59b077

Please sign in to comment.