Introduce a helper function to identify valid (non-zero) time stamps.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This commit is contained in:
		
							parent
							
								
									4fb0346520
								
							
						
					
					
						commit
						b295df24b5
					
				
							
								
								
									
										2
									
								
								msg.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								msg.c
									
									
									
									
									
								
							@ -468,5 +468,5 @@ int msg_sots_missing(struct ptp_message *m)
 | 
			
		||||
	default:
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	return (!m->hwts.ts.tv_sec && !m->hwts.ts.tv_nsec) ? 1 : 0;
 | 
			
		||||
	return msg_sots_valid(m) ? 0 : 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								msg.h
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								msg.h
									
									
									
									
									
								
							@ -338,6 +338,16 @@ void msg_put(struct ptp_message *m);
 | 
			
		||||
 */
 | 
			
		||||
int msg_sots_missing(struct ptp_message *m);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Test whether a message has a valid SO_TIMESTAMPING time stamp.
 | 
			
		||||
 * @param m  Message to test.
 | 
			
		||||
 * @return   One if the message has a valid time stamp, zero otherwise.
 | 
			
		||||
 */
 | 
			
		||||
static inline int msg_sots_valid(struct ptp_message *m)
 | 
			
		||||
{
 | 
			
		||||
	return (m->hwts.ts.tv_sec || m->hwts.ts.tv_nsec) ? 1 : 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Work around buggy 802.1AS switches.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user