mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Fixed setting system time to avoid time jumps in case of faulty data
This commit is contained in:
		@@ -469,6 +469,7 @@ Oliver Lorei <oliverlorei@cityweb.de>
 | 
			
		||||
 | 
			
		||||
Andreas B<>ttger <fboettger@t-online.de>
 | 
			
		||||
 for reporting a bug in skipping forward in time shift mode near the end of the recording
 | 
			
		||||
 for fixing setting system time to avoid time jumps in case of faulty data
 | 
			
		||||
 | 
			
		||||
Onno Kreuzinger <ok@solutas.net>
 | 
			
		||||
 for reporting leftover references to the file FORMATS in MANUAL and svdrp.c
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							@@ -3668,3 +3668,5 @@ Video Disk Recorder Revision History
 | 
			
		||||
  a forced EPG scan works even if EPG scan timeout is set to 0 (thanks to
 | 
			
		||||
  Bernhard Stegmaier for reporting a problem with this).
 | 
			
		||||
- Fixed cDvbSpuBitmap::putPixel() (thanks to Reinhard Nissl).
 | 
			
		||||
- Fixed setting system time to avoid time jumps in case of faulty data (thanks
 | 
			
		||||
  to Andreas B<>ttger).
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								eit.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								eit.c
									
									
									
									
									
								
							@@ -8,7 +8,7 @@
 | 
			
		||||
 * Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
 | 
			
		||||
 * Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
 | 
			
		||||
 *
 | 
			
		||||
 * $Id: eit.c 1.108 2005/06/11 15:31:21 kls Exp $
 | 
			
		||||
 * $Id: eit.c 1.109 2005/08/07 13:52:29 kls Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "eit.h"
 | 
			
		||||
@@ -252,11 +252,13 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
 | 
			
		||||
class cTDT : public SI::TDT {
 | 
			
		||||
private:
 | 
			
		||||
  static cMutex mutex;
 | 
			
		||||
  static int lastDiff;
 | 
			
		||||
public:
 | 
			
		||||
  cTDT(const u_char *Data);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
cMutex cTDT::mutex;
 | 
			
		||||
int cTDT::lastDiff = 0;
 | 
			
		||||
 | 
			
		||||
cTDT::cTDT(const u_char *Data)
 | 
			
		||||
:SI::TDT(Data, false)
 | 
			
		||||
@@ -266,12 +268,16 @@ cTDT::cTDT(const u_char *Data)
 | 
			
		||||
  time_t sattim = getTime();
 | 
			
		||||
  time_t loctim = time(NULL);
 | 
			
		||||
 | 
			
		||||
  if (abs(sattim - loctim) > 2) {
 | 
			
		||||
  int diff = abs(sattim - loctim);
 | 
			
		||||
  if (diff > 2) {
 | 
			
		||||
     mutex.Lock();
 | 
			
		||||
     isyslog("System Time = %s (%ld)\n", *TimeToString(loctim), loctim);
 | 
			
		||||
     isyslog("Local Time  = %s (%ld)\n", *TimeToString(sattim), sattim);
 | 
			
		||||
     if (stime(&sattim) < 0)
 | 
			
		||||
        esyslog("ERROR while setting system time: %m");
 | 
			
		||||
     if (abs(diff - lastDiff) < 3) {
 | 
			
		||||
        isyslog("System Time = %s (%ld)\n", *TimeToString(loctim), loctim);
 | 
			
		||||
        isyslog("Local Time  = %s (%ld)\n", *TimeToString(sattim), sattim);
 | 
			
		||||
        if (stime(&sattim) < 0)
 | 
			
		||||
           esyslog("ERROR while setting system time: %m");
 | 
			
		||||
        }
 | 
			
		||||
     lastDiff = diff;
 | 
			
		||||
     mutex.Unlock();
 | 
			
		||||
     }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user