mTCP SNTP (Simple Network Time Protocol)
2013-04-26 Version
Michael Brutman (mbbrutman@gmail.com)


Introduction

  SNTP is a small utility that lets you fetch the current time and date
  from an NTP server on the internet.  This is useful if your machine
  does not have a battery backed clock/calendar or if you want to adjust
  for the drift that is inherent in most older clock/calendar solutions.


Hardware requirements

  8088 processor or better
  56KB available RAM
  CGA, Monochrome (MDA), EGA or VGA display
  Supported Ethernet card, SLIP or PPP connection


Software requirements

  DOS 2.1 or newer
  Packet driver for your Ethernet adapter


Setup instructions

  SNTP is built using the mTCP library.  The setup instructions for
  mTCP can be found in SETUP.TXT.


Using SNTP

  Usage is like this:

    sntp [options] <ntp.server>

  Options are:

    -help           Show a help message
    -port <n>       Contact server on port <n> (default=123)
    -retries <n>    Number of times to retry if no answer (default=1)
    -set            Set the system time
    -timeout <n>    Seconds to wait for a server response (default=3)


  The NTP server parameter can be any NTP server on the network.  I
  recommend using 'pool.ntp.org'.  Details on this collection of servers
  can be found at http://www.pool.ntp.org/ .

  Before running SNTP you should set the 'TZ' environment variable in
  DOS.  The date and time that you get from the NTP server will be in
  Universal Coordinated Time and needs to be adjusted for your local
  timezone.  The TZ environment variable tells the code what your local
  timezone is and how to make that adjustment.

  Here are some example timezone settings:

    set TZ=EST5EDT     (US Eastern Standard, 5 hour offset, DST is observed)
    set TZ=CST6CDT     (US Central Standard, 6 hour offset, DST is observed)
    set TZ=UTC-1       (One hour east of GMT, somewhere in Europe)
    set TZ=CET-2CDT    (Two hours east of GMT, DST is observed)


  Some of you might note that the time offset is opposite of what Windows
  uses.  That is because the program is using the POSIX standard for setting
  the TZ environment variable.  Sorry, that is just the way it is.  If you
  are west of GMT the offset is positive and if you are east of GMT the
  offset is negative.

  If you want to see the full rules for setting the TZ environment variable
  including how to set it for complex daylight savings rules, please see the
  Open Watcom documentation:

    http://www.openwatcom.org/ftp/manuals/current/clib.pdf

  Look for the section entitled "The TZ Environment Variable."
  
  SNTP uses the UDP protocol to contact the NTP server.  UDP is not a
  reliable way to send packets on the network, so packets are often lost.
  The -retries option can be used to improve the chances that SNTP will
  be able to get a reponse from an NTP server.

  By default SNTP only tells you the time that it received from the NTP
  server.  If you want the time to be set on your system use the -set
  option.


  Examples:

    set TZ=CST6CDT                 Set timezone to US Central Standard

    sntp pool.ntp.org              Get the time from pool.ntp.org
    sntp -retries 3 pool.ntp.org   Same as above, but retry up to three times
    sntp -set pool.ntp.org         Set the system time to the NTP time


Miscellaneous notes

  SNTP is accurate to within about one second.  NTP servers will return
  time stamps with much higher resolution but after you deal with network
  jitter and delays it is not as accurate.  Combine that with DOS which has
  a default timer resolution of 55ms and there is just no point in trying
  to make it more accurate.  One second is great for most of us on older
  hardware.


Support

  Have a comment or need help?  Please email me at mbbrutman@gmail.com.


Recent changes

  2011-05-27: First open source release (GPL3)
  2010-08-21: Initial version


More information: http://www.brutman.com/mTCP

Created September 16th, 2010, Last updated April 26th, 2013
(C)opyright Michael B. Brutman, mbbrutman@gmail.com
