remove RTC time pull (#31829)
	
		
	
				
					
				
			* remove RTC time pull
* and syncing
* bump panda
* bump panda
old-commit-hash: 78d72d7dc3
			
			
				vw-mqb-aeb
			
			
		
							parent
							
								
									1d014c0892
								
							
						
					
					
						commit
						b26565d793
					
				
				 7 changed files with 1 additions and 129 deletions
			
			
		@ -1 +1 @@ | 
				
			|||||||
Subproject commit 4b6f6ac1629d001ced6e86f43579d399230af614 | 
					Subproject commit 895a7001c9d21ac7c4ace65debe70dfaee017443 | 
				
			||||||
@ -1,38 +0,0 @@ | 
				
			|||||||
#!/usr/bin/env python3 | 
					 | 
				
			||||||
import os | 
					 | 
				
			||||||
import datetime | 
					 | 
				
			||||||
from panda import Panda | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
from openpilot.common.time import MIN_DATE | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def set_time(logger): | 
					 | 
				
			||||||
  sys_time = datetime.datetime.today() | 
					 | 
				
			||||||
  if sys_time > MIN_DATE: | 
					 | 
				
			||||||
    logger.info("System time valid") | 
					 | 
				
			||||||
    return | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  try: | 
					 | 
				
			||||||
    ps = Panda.list() | 
					 | 
				
			||||||
    if len(ps) == 0: | 
					 | 
				
			||||||
      logger.error("Failed to set time, no pandas found") | 
					 | 
				
			||||||
      return | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    for s in ps: | 
					 | 
				
			||||||
      with Panda(serial=s) as p: | 
					 | 
				
			||||||
        if not p.is_internal(): | 
					 | 
				
			||||||
          continue | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # Set system time from panda RTC time | 
					 | 
				
			||||||
        panda_time = p.get_datetime() | 
					 | 
				
			||||||
        if panda_time > MIN_DATE: | 
					 | 
				
			||||||
          logger.info(f"adjusting time from '{sys_time}' to '{panda_time}'") | 
					 | 
				
			||||||
          os.system(f"TZ=UTC date -s '{panda_time}'") | 
					 | 
				
			||||||
        break | 
					 | 
				
			||||||
  except Exception: | 
					 | 
				
			||||||
    logger.exception("Failed to fetch time from panda") | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if __name__ == "__main__": | 
					 | 
				
			||||||
  import logging | 
					 | 
				
			||||||
  logging.basicConfig(level=logging.DEBUG) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  set_time(logging) | 
					 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue