|  |  | @ -11,6 +11,9 @@ from timezonefinder import TimezoneFinder | 
			
		
	
		
		
			
				
					
					|  |  |  | from openpilot.common.params import Params |  |  |  | from openpilot.common.params import Params | 
			
		
	
		
		
			
				
					
					|  |  |  | from openpilot.system.hardware import AGNOS |  |  |  | from openpilot.system.hardware import AGNOS | 
			
		
	
		
		
			
				
					
					|  |  |  | from openpilot.system.swaglog import cloudlog |  |  |  | from openpilot.system.swaglog import cloudlog | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | from openpilot.system.version import get_version | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | REQUEST_HEADERS = {'User-Agent': "openpilot-" + get_version()} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | def set_timezone(valid_timezones, timezone): |  |  |  | def set_timezone(valid_timezones, timezone): | 
			
		
	
	
		
		
			
				
					|  |  | @ -18,7 +21,7 @@ def set_timezone(valid_timezones, timezone): | 
			
		
	
		
		
			
				
					
					|  |  |  |     cloudlog.error(f"Timezone not supported {timezone}") |  |  |  |     cloudlog.error(f"Timezone not supported {timezone}") | 
			
		
	
		
		
			
				
					
					|  |  |  |     return |  |  |  |     return | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   cloudlog.debug(f"Setting timezone to {timezone}") |  |  |  |   cloudlog.info(f"Setting timezone to {timezone}") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   try: |  |  |  |   try: | 
			
		
	
		
		
			
				
					
					|  |  |  |     if AGNOS: |  |  |  |     if AGNOS: | 
			
		
	
		
		
			
				
					
					|  |  |  |       tzpath = os.path.join("/usr/share/zoneinfo/", timezone) |  |  |  |       tzpath = os.path.join("/usr/share/zoneinfo/", timezone) | 
			
		
	
	
		
		
			
				
					|  |  | @ -58,7 +61,7 @@ def main() -> NoReturn: | 
			
		
	
		
		
			
				
					
					|  |  |  |     if location is None: |  |  |  |     if location is None: | 
			
		
	
		
		
			
				
					
					|  |  |  |       cloudlog.debug("Setting timezone based on IP lookup") |  |  |  |       cloudlog.debug("Setting timezone based on IP lookup") | 
			
		
	
		
		
			
				
					
					|  |  |  |       try: |  |  |  |       try: | 
			
		
	
		
		
			
				
					
					|  |  |  |         r = requests.get("https://ipapi.co/timezone", timeout=10) |  |  |  |         r = requests.get("https://ipapi.co/timezone", headers=REQUEST_HEADERS, timeout=10) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         if r.status_code == 200: |  |  |  |         if r.status_code == 200: | 
			
		
	
		
		
			
				
					
					|  |  |  |           set_timezone(valid_timezones, r.text) |  |  |  |           set_timezone(valid_timezones, r.text) | 
			
		
	
		
		
			
				
					
					|  |  |  |         else: |  |  |  |         else: | 
			
		
	
	
		
		
			
				
					|  |  | 
 |