Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
"""Verify the date because Apple can't."""
import datetime
import shell_tools
import sys_tools
current_year = int(
sys_tools.log('CPE-date_verification', 'Year is: %s' % current_year)
if current_year > 2017:
# If the date is > 2017, then Apple has fucked up again
sys_tools.log('CPE-date_verification', 'Year is > 2017: %s' % current_year)
# Manually set the current date to something reasonable, because if it's
# too far in advance, ntpdate can't fix itself
system_results = shell_tools.run_subp([
if not system_results['success']:
sys_tools.log('CPE-date_verification', "Fixing the date didn't work!")
results = shell_tools.run_subp([
if not results['success']:
sys_tools.log('CPE-date_verification', "ntpdate didn't work!")
'Adjusted time. Current year is: %s ' % int(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.