phc2sys: Use currentUtcOffset only with PTP timescale.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2013-05-07 14:32:21 +02:00 committed by Richard Cochran
parent 4a3e5857b1
commit 3414d99609
1 changed files with 11 additions and 8 deletions

View File

@ -368,6 +368,7 @@ static int run_pmc(struct clock *clock, int timeout,
int wait_sync, int get_utc_offset)
{
struct ptp_message *msg;
struct timePropertiesDS *tds;
void *data;
#define N_FD 1
struct pollfd pollfd[N_FD];
@ -440,14 +441,16 @@ static int run_pmc(struct clock *clock, int timeout,
break;
case TIME_PROPERTIES_DATA_SET:
clock->sync_offset = ((struct timePropertiesDS *)data)->
currentUtcOffset;
if (((struct timePropertiesDS *)data)->flags & LEAP_61)
tds = (struct timePropertiesDS *)data;
if (tds->flags & PTP_TIMESCALE) {
clock->sync_offset = tds->currentUtcOffset;
if (tds->flags & LEAP_61)
clock->leap = 1;
else if (((struct timePropertiesDS *)data)->flags & LEAP_59)
else if (tds->flags & LEAP_59)
clock->leap = -1;
else
clock->leap = 0;
}
ds_done = 1;
break;
}