Commit ee21b718 authored by Alessandro Rubini's avatar Alessandro Rubini

general: kill set_TimeInternal

set_TimeInternal was partial anyways, since TimeInternal is more than
seconds and nanoseconds (even if only WR uses it).  It was only used
to zero the values, so use memset instead, within the new
inline clear_TimeInternal()
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 8aca3926
......@@ -21,7 +21,7 @@ void bare_main_loop(struct pp_instance *ppi)
{
int delay_ms;
set_TimeInternal(&ppi->last_rcv_time, 0, 0);
clear_TimeInternal(&ppi->last_rcv_time);
NP(ppi)->proto_ofst = 14;
/*
......
......@@ -21,7 +21,7 @@ void bare_main_loop(struct pp_instance *ppi)
{
int delay_ms;
set_TimeInternal(&ppi->last_rcv_time, 0, 0);
clear_TimeInternal(&ppi->last_rcv_time);
NP(ppi)->proto_ofst = 14;
/*
......
......@@ -18,7 +18,7 @@ void posix_main_loop(struct pp_instance *ppi)
{
int delay_ms;
set_TimeInternal(&ppi->last_rcv_time, 0, 0);
clear_TimeInternal(&ppi->last_rcv_time);
if (OPTS(ppi)->ethernet_mode)
NP(ppi)->proto_ofst = 14;
......
......@@ -73,6 +73,11 @@ typedef struct TimeInternal {
/* White Rabbit extension end */
} TimeInternal;
static inline void clear_TimeInternal(struct TimeInternal *t)
{
memset(t, 0, sizeof(*t));
}
typedef Octet ClockIdentity[PP_CLOCK_IDENTITY_LENGTH];
typedef struct PortIdentity {
......
......@@ -410,7 +410,6 @@ extern int from_TimeInternal(TimeInternal *internal, Timestamp *external);
extern int to_TimeInternal(TimeInternal *internal, Timestamp *external);
extern void add_TimeInternal(TimeInternal *r, TimeInternal *x, TimeInternal *y);
extern void sub_TimeInternal(TimeInternal *r, TimeInternal *x, TimeInternal *y);
extern void set_TimeInternal(TimeInternal *t, Integer32 s, Integer32 ns);
extern void display_TimeInternal(const char *label, TimeInternal *t);
extern void div2_TimeInternal(TimeInternal *r);
......
......@@ -100,12 +100,6 @@ void div2_TimeInternal(TimeInternal *r)
normalize_TimeInternal(r);
}
void set_TimeInternal(TimeInternal *t, Integer32 s, Integer32 ns)
{
t->seconds = s;
t->nanoseconds = ns;
}
void display_TimeInternal(const char *label, TimeInternal *t)
{
PP_VPRINTF("%s: %s%d.%09d\n", label,
......
......@@ -11,8 +11,8 @@ void pp_init_clock(struct pp_instance *ppi)
PP_PRINTF("SERVO init clock\n");
/* clear vars */
set_TimeInternal(&SRV(ppi)->m_to_s_dly, 0, 0);
set_TimeInternal(&SRV(ppi)->s_to_m_dly, 0, 0);
clear_TimeInternal(&SRV(ppi)->m_to_s_dly);
clear_TimeInternal(&SRV(ppi)->s_to_m_dly);
SRV(ppi)->obs_drift = 0; /* clears clock servo accumulator (the
* I term) */
SRV(ppi)->owd_fltr.s_exp = 0; /* clears one-way delay filter */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment