Add leap function to servo.
Introduce a new function to inform the servo about upcoming leap second. This is used when the kernel leap is disabled to allow the servo to handle better the sudden 1 second step in the offset when the leap second is inserted or deleted. Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>master
parent
7d740f17e5
commit
2aa6b10c3b
2
clock.c
2
clock.c
|
@ -697,6 +697,8 @@ static int clock_utc_correct(struct clock *c, tmv_t ingress)
|
||||||
if (c->leap_set != clock_leap) {
|
if (c->leap_set != clock_leap) {
|
||||||
if (c->kernel_leap)
|
if (c->kernel_leap)
|
||||||
sysclk_set_leap(clock_leap);
|
sysclk_set_leap(clock_leap);
|
||||||
|
else
|
||||||
|
servo_leap(c->servo, clock_leap);
|
||||||
c->leap_set = clock_leap;
|
c->leap_set = clock_leap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1114,6 +1114,8 @@ static int clock_handle_leap(struct node *node, struct clock *clock,
|
||||||
if (clock->clkid == CLOCK_REALTIME &&
|
if (clock->clkid == CLOCK_REALTIME &&
|
||||||
node->kernel_leap)
|
node->kernel_leap)
|
||||||
sysclk_set_leap(clock_leap);
|
sysclk_set_leap(clock_leap);
|
||||||
|
else
|
||||||
|
servo_leap(clock->servo, clock_leap);
|
||||||
clock->leap_set = clock_leap;
|
clock->leap_set = clock_leap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
servo.c
6
servo.c
|
@ -107,3 +107,9 @@ double servo_rate_ratio(struct servo *servo)
|
||||||
|
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void servo_leap(struct servo *servo, int leap)
|
||||||
|
{
|
||||||
|
if (servo->leap)
|
||||||
|
servo->leap(servo, leap);
|
||||||
|
}
|
||||||
|
|
8
servo.h
8
servo.h
|
@ -132,4 +132,12 @@ void servo_reset(struct servo *servo);
|
||||||
*/
|
*/
|
||||||
double servo_rate_ratio(struct servo *servo);
|
double servo_rate_ratio(struct servo *servo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inform a clock servo about upcoming leap second.
|
||||||
|
* @param servo Pointer to a servo obtained via @ref servo_create().
|
||||||
|
* @param leap +1 when leap second will be inserted, -1 when leap second
|
||||||
|
* will be deleted, 0 when it passed.
|
||||||
|
*/
|
||||||
|
void servo_leap(struct servo *servo, int leap);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,6 +38,8 @@ struct servo {
|
||||||
void (*reset)(struct servo *servo);
|
void (*reset)(struct servo *servo);
|
||||||
|
|
||||||
double (*rate_ratio)(struct servo *servo);
|
double (*rate_ratio)(struct servo *servo);
|
||||||
|
|
||||||
|
void (*leap)(struct servo *servo, int leap);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue