Commit 65c47ec6 authored by Tristan Gingold's avatar Tristan Gingold

time-arith: constify

servo: reindent
parent 3e222093
......@@ -395,14 +395,14 @@ extern int msg_issue_pdelay_resp(struct pp_instance *ppi, struct pp_time *time);
/* Functions for time math */
extern void normalize_pp_time(struct pp_time *t);
extern void pp_time_add(struct pp_time *t1, struct pp_time *t2);
extern void pp_time_sub(struct pp_time *t1, struct pp_time *t2);
extern void pp_time_add(struct pp_time *t1, const struct pp_time *t2);
extern void pp_time_sub(struct pp_time *t1, const struct pp_time *t2);
extern void pp_time_div2(struct pp_time *t);
extern TimeInterval pp_time_to_interval(struct pp_time *ts);
extern TimeInterval picos_to_interval(int64_t picos);
extern void pp_time_add_interval(struct pp_time *t1, TimeInterval t2);
extern void pp_time_sub_interval(struct pp_time *t1, TimeInterval t2);
extern int pp_timeout_log_to_ms ( Integer8 logValue);
extern int pp_timeout_log_to_ms(Integer8 logValue);
extern void fixedDelta_to_pp_time(struct FixedDelta fd, struct pp_time *t);
/* Function for time conversion */
......
......@@ -14,7 +14,7 @@
void normalize_pp_time(struct pp_time *t)
{
/* no 64b division please, we'll rather loop a few times */
#define SNS_PER_S ((1000LL * 1000 * 1000) << 16)
#define SNS_PER_S ((1000LL * 1000 * 1000) << 16)
/* For whatever reason we perform a normalization on an incorrect
* timestamp, don't treat is as an negative value. */
......@@ -65,7 +65,7 @@ void pp_time_sub_interval(struct pp_time *t1, TimeInterval t2)
(((a < 0) && (b < INT64_MIN - a))) \
)
void pp_time_add(struct pp_time *t1, struct pp_time *t2)
void pp_time_add(struct pp_time *t1, const struct pp_time *t2)
{
t1->secs += t2->secs;
t1->scaled_nsecs += t2->scaled_nsecs;
......@@ -77,7 +77,7 @@ void pp_time_add(struct pp_time *t1, struct pp_time *t2)
((b > 0) && (a < INT64_MIN + b)) \
)
void pp_time_sub(struct pp_time *t1, struct pp_time *t2)
void pp_time_sub(struct pp_time *t1, const struct pp_time *t2)
{
t1->secs -= t2->secs;
t1->scaled_nsecs -= t2->scaled_nsecs;
......@@ -113,7 +113,8 @@ int64_t pp_time_to_picos(struct pp_time *t)
return ret;
}
void fixedDelta_to_pp_time(struct FixedDelta fd, struct pp_time *t) {
void fixedDelta_to_pp_time(struct FixedDelta fd, struct pp_time *t)
{
/* FixedDelta is expressed in ps*2^16 */
uint64_t v = ((uint64_t)fd.scaledPicoseconds.msb)<<32 | (uint64_t)fd.scaledPicoseconds.lsb;
__div64_32(&v,1000);
......
......@@ -21,7 +21,7 @@
#define SNMP_MAX_OFFSET_PS 500
#define SNMP_MAX_DELTA_RTT_PS 1000
static const char *wrh_servo_state_name[] = {
static const char * const wrh_servo_state_name[] = {
[WRH_UNINITIALIZED] = "Uninitialized",
[WRH_SYNC_NSEC] = "SYNC_NSEC",
[WRH_SYNC_TAI] = "SYNC_SEC",
......
......@@ -3,8 +3,11 @@
#include "../proto-standard/common-fun.h"
static inline void _calculate_raw_delayMM(struct pp_instance *ppi,
struct pp_time *ta,struct pp_time *tb,
struct pp_time *tc,struct pp_time *td ) {
const struct pp_time *ta,
const struct pp_time *tb,
const struct pp_time *tc,
const struct pp_time *td)
{
wr_servo_ext_t *se=WRE_SRV(ppi);
/* The calculation done will be
......@@ -12,7 +15,7 @@ static inline void _calculate_raw_delayMM(struct pp_instance *ppi,
*/
struct pp_time *sa=&se->rawDelayMM,sb;
/* sa = td-ta) */
/* sa = (td-ta) */
*sa=*td;
pp_time_sub(sa,ta);
/* sb = (tc-tb) */
......@@ -63,7 +66,8 @@ int wr_servo_got_resp(struct pp_instance *ppi) {
return wrh_servo_got_resp(ppi);
}
int wr_servo_got_presp(struct pp_instance *ppi) {
int wr_servo_got_presp(struct pp_instance *ppi)
{
/* Re-adjust T3,T4,T5 and T6 */
wr_servo_ext_t *se=WRE_SRV(ppi);
......
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