Time off by -5 hours

View: New views
8 Messages — Rating Filter:   Alert me  

Time off by -5 hours

by email builder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

  We have several servers set up with a hybrid between this:

http://fte.tegtmeyer.net/djbware/clockspeed_setup.html

  and the very similar information at thedjbway.org, which seems to be
offline right now.

  All our servers except two have the correct time; the two that are not
correct are both off by -5 hours.  I am guessing (but have no proof) that
they lost synch during the DST time change last Sunday.

  I am tempted to just restart all the clockspeed stuff and see if it catches
the right time (we configured the above system to get it from NTP), but I'm
afraid that that will mask the problem, so I am hoping someone might have
some pointers of where this might be caused before I just try to reset the
time.

  Oh, and the timezone on the machines appears correct.

Help?



               
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

Re: Time off by -5 hours

by email builder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>   We have several servers set up with a hybrid between this:
>
> http://fte.tegtmeyer.net/djbware/clockspeed_setup.html
>
>   and the very similar information at thedjbway.org, which seems to be
> offline right now.
>
>   All our servers except two have the correct time; the two that are not
> correct are both off by -5 hours.  I am guessing (but have no proof) that
> they lost synch during the DST time change last Sunday.
>
>   I am tempted to just restart all the clockspeed stuff and see if it
> catches
> the right time (we configured the above system to get it from NTP), but I'm
> afraid that that will mask the problem, so I am hoping someone might have
> some pointers of where this might be caused before I just try to reset the
> time.
>
>   Oh, and the timezone on the machines appears correct.

Looking at the log files, the NTP server we chose to use in our config file
apparently has changed or is otherwise not available these days:

sntpclock: warning: unable to read clock: timed out
sntpclock: warning: unable to read clock: timed out
sntpclock: fatal: time uncertainty too large
clockadd: fatal: data split across packets

However, all our servers are getting this error; why would only two of them
have lost five hours?

Thanks



               
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

Re: Time off by -5 hours

by email builder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> >   We have several servers set up with a hybrid between this:
> >
> > http://fte.tegtmeyer.net/djbware/clockspeed_setup.html
> >
> >   and the very similar information at thedjbway.org, which seems to be
> > offline right now.
> >
> >   All our servers except two have the correct time; the two that are not
> > correct are both off by -5 hours.  I am guessing (but have no proof) that
> > they lost synch during the DST time change last Sunday.
> >
> >   I am tempted to just restart all the clockspeed stuff and see if it
> > catches
> > the right time (we configured the above system to get it from NTP), but
> I'm
> > afraid that that will mask the problem, so I am hoping someone might have
> > some pointers of where this might be caused before I just try to reset
> the
> > time.
> >
> >   Oh, and the timezone on the machines appears correct.
>
> Looking at the log files, the NTP server we chose to use in our config file
> apparently has changed or is otherwise not available these days:
>
> sntpclock: warning: unable to read clock: timed out
> sntpclock: warning: unable to read clock: timed out
> sntpclock: fatal: time uncertainty too large
> clockadd: fatal: data split across packets
>
> However, all our servers are getting this error; why would only two of them
> have lost five hours?

Still not found an answer to the five hour loss, but what was interesting was
that when I updated our "clockctl" config file with an active NTP server
(anyone have an enhanced version of this approach that allows for using a
list of NTP servers so we can have some fallback?), the machine said that it
had the correct time all along.  As shown by the date command run just prior,
that was not the case.  Why/how would this happen?  Here is the actual series
of events:

# date
Thu Nov  3 17:15:59 PST 2005
# /etc/clockspeed/clockctl sync
Setting system clock with master server at www.xxx.yyy.zzz:
before: 2005-11-03 22:17:28.182072000000000000
after:  2005-11-03 22:17:28.182235999833472072
# date
Thu Nov  3 22:17:41 PST 2005

That is rather odd, is it not?





               
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

Re: Time off by -5 hours

by email builder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

(CC: Frank Tegtmeyer and Wayne Marshall, see below)

> > >   We have several servers set up with a hybrid between this:
> > >
> > > http://fte.tegtmeyer.net/djbware/clockspeed_setup.html
> > >
> > >   and the very similar information at thedjbway.org, which seems to be
> > > offline right now.
> > >
> > >   All our servers except two have the correct time; the two that are
> not
> > > correct are both off by -5 hours.  I am guessing (but have no proof)
> that
> > > they lost synch during the DST time change last Sunday.
> > >
> > >   I am tempted to just restart all the clockspeed stuff and see if it
> > > catches
> > > the right time (we configured the above system to get it from NTP), but
> > I'm
> > > afraid that that will mask the problem, so I am hoping someone might
> have
> > > some pointers of where this might be caused before I just try to reset
> > the
> > > time.
> > >
> > >   Oh, and the timezone on the machines appears correct.
> >
> > Looking at the log files, the NTP server we chose to use in our config
> file
> > apparently has changed or is otherwise not available these days:
> >
> > sntpclock: warning: unable to read clock: timed out
> > sntpclock: warning: unable to read clock: timed out
> > sntpclock: fatal: time uncertainty too large
> > clockadd: fatal: data split across packets
> >
> > However, all our servers are getting this error; why would only two of
> them
> > have lost five hours?
>
> Still not found an answer to the five hour loss, but what was interesting
> was
> that when I updated our "clockctl" config file with an active NTP server
> (anyone have an enhanced version of this approach that allows for using a
> list of NTP servers so we can have some fallback?),

A little bit of an aside, but we just hacked up a solution to this
paranthetical.  Our config file for this setup now looks like this:

CLOCK_IPS[0]="999.888.777.666"
CLOCK_IPS[1]=`dnsip abc.def.edu | sed 's/ .*//'`
CLOCK_IPS[2]=`dnsip example.com | sed 's/ .*//'`
CLOCK_IPS[3]="666.777.888.999"

We use DNS to resolve the ones that state to use DNS according to their
listing with ntp.isc.org and just IPs for all others.

And our "clockctl" will now start looking for a responsive NTP server
starting at a random point in the array of NTP servers and only try to update
time with a given server if it is currently responding to NTP requests.  We
added this function (and we call it, of course, before we process anything
else in this script):

# choose which CLOCK_IP to use
#
choose_clock_ip()
{
  echo "Looking for an active master server..."

  # start in random place in array
  MAX=${#CLOCK_IPS[@]}
  START=$RANDOM
  let "START %= $MAX"  # gives random number less than $MAX
  J="$START"

  CLOCK_IP=0
  while test 1; do

      echo "Trying ${CLOCK_IPS[$J]}..."
      ${CLOCKSPEED_BIN}/sntpclock "${CLOCK_IPS[$J]}" > /dev/null
      if [ $? = 0 ]; then
          CLOCK_IP="${CLOCK_IPS[$J]}"
          echo "Will use ${CLOCK_IPS[$J]}"
          break
      fi

      # loop control...
      J=`expr $J + 1`

      if [ $J = $START ]; then
          break

      elif [ $J = $MAX -a $START = 0 ]; then
          break

      elif [ $J = $MAX ]; then
          J=0
      fi

  done

  if [ $CLOCK_IP = 0 ] ; then
      echo "$0: server error: no master servers were reachable"
      exit 1;
  fi
}



Still looking for the five hour mystery, however......



> the machine said that
> it
> had the correct time all along.  As shown by the date command run just
> prior,
> that was not the case.  Why/how would this happen?  Here is the actual
> series
> of events:
>
> # date
> Thu Nov  3 17:15:59 PST 2005
> # /etc/clockspeed/clockctl sync
> Setting system clock with master server at www.xxx.yyy.zzz:
> before: 2005-11-03 22:17:28.182072000000000000
> after:  2005-11-03 22:17:28.182235999833472072
> # date
> Thu Nov  3 22:17:41 PST 2005
>
> That is rather odd, is it not?




               
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

Re: Time off by -5 hours

by Ben Mesander :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

email builder writes:
 > Still looking for the five hour mystery, however......

Is 5 hours your local TZ offset from UTC either before or after the
daylight savings transition?

Regards,
Ben

Re: Time off by -5 hours

by email builder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> email builder writes:
>  > Still looking for the five hour mystery, however......
>
> Is 5 hours your local TZ offset from UTC either before or after the
> daylight savings transition?

Sorry, I should have mentioned that.  No, it is not.  We are in California,
which is currently GMT-8, or before the change GMT-7.  I am really not sure
where the five hour thing comes from and why two of our servers both did the
same thing.

Thanks


       
               
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

Parent Message unknown Re: Time off by -5 hours

by email builder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> >> that when I updated our "clockctl" config file with an active NTP server
> >> (anyone have an enhanced version of this approach that allows for using
> a
> >> list of NTP servers so we can have some fallback?),
>
> I just came across the OpenBSD setup of ntp - they use pool.ntp.org as
> source. This gives a random set of 8 IP addresses of Stratum2 servers.

Oh, nice.  Thank you.
 
> I will look at the test function later - I'm too tired now.

I fixed it so that it is not specific to NTP; should also work for taiclock
users as well now.  I think it's more based on thedjbway.org's
implementation, but I don't think that's too far removed from yours, Frank.
I have pasted the whole script in below for the sake of completeness.


#!/bin/sh
# interface to djb clockspeed
# ===

# read configuration:
if [ -r /etc/clockspeed/clockspeed.conf ] ; then
  . /etc/clockspeed/clockspeed.conf
else
  echo "$0: configuration error: unable to read clockspeed.conf"
  exit 1
fi


# choose which CLOCK_IP to use
#
choose_clock_ip()
{
  echo "Looking for an active master server..."

  # start in random place in array
  MAX=${#CLOCK_IPS[@]}
  START=$RANDOM
  let "START %= $MAX"  # gives random number less than $MAX

  # set $START to an index that you KNOW will fail here
  # to test that this function actually works
  #START=15

  J="$START"
  CLOCK_IP=0
  while test 1; do

      echo "Trying ${CLOCK_IPS[$J]}..."
      clock_pick ${CLOCK_IPS[$J]} 1
      if [ $? = 0 ]; then
          CLOCK_IP="${CLOCK_IPS[$J]}"
          echo "Will use ${CLOCK_IPS[$J]}"
          break
      fi

      # loop control...
      J=`expr $J + 1`

      if [ $J = $START ]; then
          break

      elif [ $J = $MAX -a $START = 0 ]; then
          break

      elif [ $J = $MAX ]; then
          J=0
      fi

  done

  if [ $CLOCK_IP = 0 ] ; then
      echo "$0: server error: no master servers were reachable"
      exit 1;
  fi
}


# clock_pick function:
#
# Expected args:
#    $1 - The IP of the master server to use
#    $2 - Hide output? 1 = Yes, any other (or no) value = No
#
clock_pick()
{
  case ${CLOCK_TYPE} in
  ntp|NTP)
      if [ "$2" = 1 ] ; then
          ${CLOCKSPEED_BIN}/sntpclock "$1" > /dev/null
      else
          ${CLOCKSPEED_BIN}/sntpclock "$1"
      fi
      ;;
  tai|TAI)
      if [ "$2" = 1 ] ; then
          ${CLOCKSPEED_BIN}/taiclock "$1" > /dev/null
      else
          ${CLOCKSPEED_BIN}/taiclock "$1"
      fi
      ;;
  *)
      echo "$0: configuration error: CLOCK_TYPE not recognized"
      exit 1;
      ;;
   esac
}


# make sure we have a good master server to connect to
choose_clock_ip


# process command:
case $1 in
a|atto)
    echo "Viewing current attoseconds in hardware tick:"
    ${CLOCKSPEED_BIN}/clockview < ${CLOCKSPEED_HOME}/etc/atto
    ;;
m|mark)
    echo "Obtaining new calibration mark from master server at ${CLOCK_IP}:"
    clock_pick ${CLOCK_IP} | tee ${CLOCKSPEED_HOME}/adjust |
${CLOCKSPEED_BIN}/clockview
    ;;
s|sync)
    echo "Setting system clock with master server at ${CLOCK_IP}:"
    clock_pick ${CLOCK_IP} | ${CLOCKSPEED_BIN}/clockadd && \
    clock_pick ${CLOCK_IP} | ${CLOCKSPEED_BIN}/clockview
    ;;
v|view)
    echo "Checking system clock against master server at ${CLOCK_IP}
(clockview):"
    clock_pick ${CLOCK_IP} | ${CLOCKSPEED_BIN}/clockview
    ;;
h|help)
    cat <<END_HELP
clockspeed control:
  atto -- inspect current "attoseconds"
  mark -- obtain new calibration mark for clockspeed
  sync -- set the system clock with master time server
  view -- check system clock against master time server
  help -- this screen
END_HELP
    ;;

*)
    echo "Usage: $0 [ a|atto | m|mark | s|sync | v|view | h|help ]"
    exit 1
    ;;
esac

exit 0




               
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs

Re: Time off by -5 hours

by Florin Izvoranu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> >
> > I just came across the OpenBSD setup of ntp - they use pool.ntp.org as
> > source. This gives a random set of 8 IP addresses of Stratum2 servers.
>
...
>
>Still not found an answer to the five hour loss, but what was interesting was
>that when I updated our "clockctl" config file with an active NTP server
>(anyone have an enhanced version of this approach that allows for using a
>list of NTP servers so we can have some fallback?),

Hi
I've used sometime ago netselect , this give you the fastest server from a
list ex.:

netselect -s1 `dnsip pool.ntp.org` | awk '{print $2}'

http://www.worldvisions.ca/~apenwarr/netselect/


Florin