@@ -368,7 +368,7 @@ static void clockfeed_on_timer(void *user_context, unsigned int id)
368
368
else
369
369
sfptpd_time_zero (& record -> snapshot );
370
370
371
- DBG_L6 ("%s: %llu: %llu: %d: "
371
+ DBG_L6 ("%s: cycle %llu: write_counter %llu: rc %d: "
372
372
SFPTPD_FMT_SFTIMESPEC " " SFPTPD_FMT_SFTIMESPEC "\n" ,
373
373
sfptpd_clock_get_short_name (source -> clock ),
374
374
source -> cycles , source -> shm .write_counter , record -> rc ,
@@ -876,7 +876,6 @@ static int clockfeed_compare_to_sys(struct sfptpd_clockfeed_sub *sub,
876
876
struct sfptpd_timespec age ;
877
877
int writer1 ;
878
878
int writer2 ;
879
- int rc = 0 ;
880
879
881
880
sfptpd_time_zero (diff );
882
881
@@ -901,7 +900,7 @@ static int clockfeed_compare_to_sys(struct sfptpd_clockfeed_sub *sub,
901
900
sample = & shm -> samples [(writer1 - 1 ) & index_mask ];
902
901
903
902
if (sample -> rc != 0 )
904
- return rc ;
903
+ return sample -> rc ;
905
904
906
905
sfptpd_time_subtract (diff , & sample -> snapshot , & sample -> system );
907
906
@@ -919,10 +918,8 @@ static int clockfeed_compare_to_sys(struct sfptpd_clockfeed_sub *sub,
919
918
sfptpd_clock_get_short_name (clock ), writer1 , sub -> min_counter );
920
919
return ESTALE ;
921
920
}
922
- if (sub -> have_max_age ) {
923
- rc = sfclock_gettime (CLOCK_MONOTONIC , & now_mono );
924
- if (rc != 0 )
925
- return EAGAIN ;
921
+ if (sub -> have_max_age &&
922
+ 0 == sfclock_gettime (CLOCK_MONOTONIC , & now_mono )) {
926
923
sfptpd_time_subtract (& age , & now_mono , & sample -> mono );
927
924
if (sfptpd_time_cmp (& age , & sub -> max_age ) > 0 ) {
928
925
WARNING (PREFIX "%s: sample too old\n" ,
@@ -936,11 +933,11 @@ static int clockfeed_compare_to_sys(struct sfptpd_clockfeed_sub *sub,
936
933
* t2 = sample -> system ;
937
934
if (mono_time )
938
935
* mono_time = sample -> mono ;
939
- if (rc == 0 ) {
936
+ if (sample -> rc == 0 ) {
940
937
sub -> read_counter = writer1 ;
941
938
}
942
939
943
- return rc ;
940
+ return sample -> rc ;
944
941
}
945
942
946
943
int sfptpd_clockfeed_compare (struct sfptpd_clockfeed_sub * sub1 ,
0 commit comments