Skip to content

Commit

Permalink
Change to UTC to fix timestamp compare
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Nemetz committed Sep 6, 2018
1 parent 9c685ed commit 1022a48
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hooks/terraform_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ def main(argv=None):
retval = 1
if object['path'] in args.paths:
# Copy maintained files
# Check repo date against file path.
# Check repo date (UTC) against file path.
# Copy if repo updated more recently or size different
# test
try:
file_time = datetime.fromtimestamp(os.path.getmtime(object['path']))
file_time = datetime.utcfromtimestamp(os.path.getmtime(object['path']))
file_size = os.path.getsize(object['path'])
if file_time < last_modified or file_size != object['size']:
print('Time: file: {} < repo: {}'.format(file_time, last_modified))
Expand Down

0 comments on commit 1022a48

Please sign in to comment.