-
-
Save mosen/a2350113ad3a29800ee312b03c258ea9 to your computer and use it in GitHub Desktop.
Forcing automatic timezone discovery with pyobjc on OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested on 10.11 | |
# Assumes your network is in a state to actually do the discovery and that you have | |
# automatic timezone discovery enabled in Date & Time and Location services enabled | |
# (Generally this means wifi enabled on your device and network stack is up) | |
# For enabling location services and auto, check Allister's work here: | |
# https://gist.github.com/arubdesu/b72585771a9f606ad800 | |
#import <Foundation> | |
NSBundle *TZPP = [NSBundle bundleWithPath:@"/System/Library/PreferencePanes/DateAndTime.prefPane/Contents/Resources/TimeZone.prefPane"]; | |
TimeZonePref = [TZPP classNamed:@"TimeZonePref"]; | |
ATZAdminPrefererences = [TZPP classNamed:@"ATZAdminPrefererences"]; | |
atzap = [ATZAdminPrefererences defaultPreferences]; | |
pref = [[TimeZonePref] alloc] init]; | |
[atzap addObserver:pref forKeyPath:"enabled" options: 0 context: 0]; | |
result = pref._startAutoTimeZoneDaemon_(0x1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment