home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
pc
/
source
/
pdclkset.lzh
/
pdclkset
Wrap
Text File
|
1990-09-14
|
10KB
|
201 lines
;*************************************************************************
;** **
;** PDCLKSET **
;** **
;** **
;** Copyright (C) 1990 Jan.Engvald @ LDC.lu.se **
;** **
;** This program is free software; you can redistribute it and/or modify**
;** it under the terms of the GNU General Public License as published by**
;** the Free Software Foundation, version 1. **
;** **
;** This program is distributed in the hope that it will be useful, **
;** but WITHOUT ANY WARRANTY; without even the implied warranty of **
;** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
;** GNU General Public License for more details. **
;** **
;** You should have received a copy of the GNU General Public License **
;** along with this program; if not, write to the Free Software **
;** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **
;** **
;*************************************************************************
;** **
;** PDCLKSET sets the time and date of the PC clock using a TIME server.**
;** To do so, the following information is required: **
;** **
;** - This clients unique IP number. **
;** - The IP number of a time server. **
;** - The time offset from UTC (GMT) at this place. **
;** - If daylight saving (summer) time is used, which algorithm to use. **
;** **
;** All the above info can be supplied as arguments to PDCLKSET. If any **
;** of the first three are missing, it will send a BOOTP request to try **
;** to find the missing info. Except for client IP number, arguments to **
;** PDCLKSET overrides BOOTP info. **
;** **
;** BOOTP can not supply which dst algorithm to use; also, time offset **
;** can't always be trusted. So, in practice, time offset and dst algo- **
;** rithm (if applicable) are required arguments. **
;** **
;** If PDCLKSET finds more than one time server (sum of arguments and **
;** BOOTP fields) and the first one does not answer, it will try the **
;** second server. **
;** **
;** It is very hard to get accurate info on all the dst algorithms used **
;** all over the world, so the one you choose, you should test out. Use **
;** the alter argument to add or subtract time and days, and check that **
;** the dst switch occurs correctly. When using the alter argument, the **
;** date and time is displayed as usual, but the PC clock is not set. **
;** If you find any errors, mail me the correct info to my mail address **
;** below. If you want to, you can customize your own dst algorithm, see**
;** detailed info below. **
;** **
;** PDCLKSET talks to the network card via a packet driver. If you have **
;** more than one packet driver, it will use the first one (lowest **
;** packet interrupt number) unless you use the pktintno argument. **
;** In AUTOEXEC.BAT you should first load the packet driver, then call **
;** PDCLKSET. It is very small (6 kbyte) and executes fast, so you will **
;** not notice any delay. PDCLKSET is not a TSR and does not require any**
;** CONFIG.SYS files, so no memory is wasted. **
;** Note: If you always log into a Novell server after a boot, you **
;** don't need this program, the PC clock will be set from the server. **
;** **
;** Call syntax: **
;** **
;** (time is [- | +]{<hours>h | <minutes>m | <seconds>[s]}) **
;** **
;** pdclkset b[ootp] or **
;** **
;** pdclkset [i[pnr]=n.n.n.n] [t[imserver]=n.n.n.n[,n.n.n.n]] **
;** **
;** [o[ffset]=time] **
;** **
;** [d[aylightsave]=PACP | USA | CUB | CHIL | BRZ | GBR | **
;** W_EU | M_EU | E_EU | LIBY | EGY | TURK | **
;** ISR | IRAN | PRC | ROK | AUS | NSW | NZE | **
;** FrTime,FrWeekDay,FrDayOfYear, **
;** ToTime,ToWday,ToDayOfYr,AddTime] **
;** **
;** [a[lter]=days,time] [p[ktintno]=decimalnr] **
;** **
;** **
;** Examples: **
;** **
;** pdclkset offs= -60m dst=M_EU (my IP nr and timeserver(s) from BOOTP)**
;** **
;** pdclkset o=5h d=USA ip=123.45.6.7 ts=123.45.6.8 (BOOTP not used)**
;** **
;*************************************************************************
;** **
;** Acknowledgments: **
;** **
;** The checksum routine used is a modified NCSA Telnet version. **
;** The dst algorithm was modelled after PCIP SETCLOCK (thanks Drew!), **
;** but enhanced to use parameters from a table. **
;** The dst algorithm table was derived from a comp.sources.unix 1989 **
;** posting by ado@ncifcrf.gov of localtime.c and related routines **
;** and tables (very useful data, thanks!). **
;** The packet driver interface routines were copied from the Clarkson **
;** packet driver distribution. **
;** The small UDP/IP library was written by me, and can probably be **
;** used in other small assembler applications. **
;* *
;* Jan Engvald, Lund University Computing Center *
;* ____________________________________________________________________ *
;* Address: Box 783 E-mail: xjeldc@ldc.lu.se *
;* S-220 07 LUND Earn/Bitnet: xjeldc@seldc52 *
;* SWEDEN (Span/Hepnet: Sweden::Gemini::xjeldc) *
;* Office: Soelvegatan 18 VAXPSI: psi%24020031020720::xjeldc *
;* Telephone: +46 46 107458 (X.400: C=se; A=TeDe; P=Sunet; O=lu; *
;* Telefax: +46 46 138225 OU=ldc; S=Engvald; G=Jan) *
;* Telex: 33533 LUNIVER S *
;* *
;*************************************************************************
;************************************************************************
;* Compile time constants *
;************************************************************************
DEBUG equ 0
IDSTRING equ 'PDCLKSET ver 0.85beta'
HR equ 60*60 ; seconds in an hour
SUN equ 0 ; Sunday
SAT equ 6 ; Saturday
DAT equ 0ffh ; Specific date follows
JANLW equ 31 ; Jan last week
FEB2W equ 31+2*7 ; Feb 2nd week
MAR1W equ 31+28+1*7 ; Mar 1st week
MAR2W equ 31+28+2*7 ; Mar 2nd week
MAR3W equ 31+28+3*7 ; Mar 2rd week
MARLW equ 31+28+31 ; Mar last week
APR01 equ 31+28+31+1 ; Apr 1
APR1W equ 31+28+31+1*7 ; Apr 1st week
APR2W equ 31+28+31+2*7 ; Apr 2nd week
APR12 equ 31+28+31+12 ; Apr 12
APR3W equ 31+28+31+3*7 ; Apr 3rd week
APRNL equ 31+28+31+30-7 ; Apr next last week
APRLW equ 31+28+31+30 ; Apr last week
MAY01 equ 31+28+31+30+1 ; May 1
MAY1W equ 31+28+31+30+1*7 ; May 1st week
MAY2W equ 31+28+31+30+2*7 ; May 2nd week
AUG4W equ 31+28+31+30+31+30+31+4*7 ; Aug 4th week
SEP1W equ 31+28+31+30+31+30+31+31+1*7 ; Sep 1st week
SEP12 equ 31+28+31+30+31+30+31+31+12 ; Sep 12
SEP2W equ 31+28+31+30+31+30+31+31+2*7 ; Sep 2nd week
SEP3W equ 31+28+31+30+31+30+31+31+3*7 ; Sep 3rd week
SEPLW equ 31+28+31+30+31+30+31+31+30 ; Sep last week
SEP30 equ 31+28+31+30+31+30+31+31+30 ; Sep 30
OCT01 equ 31+28+31+30+31+30+31+31+30+1 ; Oct 1
OCT1W equ 31+28+31+30+31+30+31+31+30+1*7 ; Oct 1st week
OCT2W equ 31+28+31+30+31+30+31+31+30+2*7 ; Oct 2nd week
OCT3W equ 31+28+31+30+31+30+31+31+30+3*7 ; Oct 3rd week
OCT24 equ 31+28+31+30+31+30+31+31+30+24 ; Oct 18 - 24
OCT4W equ 31+28+31+30+31+30+31+31+30+4*7 ; Oct 4th week
OCT29 equ 31+28+31+30+31+30+31+31+30+29 ; Oct 23 - 29
OCTLW equ 31+28+31+30+31+30+31+31+30+31 ; Oct last week
NOV13 equ 31+28+31+30+31+30+31+31+30+31+13 ; Nov 5 - 13
DEC01 equ 31+28+31+30+31+30+31+31+30+31+30+1 ; Dec 1
DEC2W equ 31+28+31+30+31+30+31+31+30+31+30+2*7 ; Dec 2nd week
AlgE struc
AlgName db "EUR " ; Name of dst algorithm
AlgFromTime dw 2*HR ; local standard time dst start
AlgFromWeekDay dw SUN ; weekday dst start
AlgFromWeek dw MARLW ; last day-of-year dst start
AlgUntilTime dw 2*HR ; local standard time dst end
AlgUntilWeekDay dw SUN ; weekday dst end
AlgUntilWeek dw SEPLW ; last day-of-year dst end
AlgAddAmount dw 1*HR ; dst advance amount
AlgEntryLen = $-AlgName
AlgE ends
AlgData struc
APac AlgE <"PACP", 2*HR,SUN,OCTLW, 1*HR,SUN,NOV13, HR> ; Pacific presidential
AUSA AlgE <"USA ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR> ; USA Canada Mexico
ACub AlgE <"CUB ", 0*HR,SUN,MAY2W,-1*HR,SUN,OCT2W, HR> ; Cuba
AChl AlgE <"CHIL", 0*HR,SUN,OCT2W,-1*HR,SUN,MAR2W, HR> ; Chile
ABrz AlgE <"BRZ ", 2*HR,SAT,OCT4W, 1*HR,SAT,FEB2W, HR> ; Brazil
AGBR AlgE <"GBR ", 1*HR,SUN,MARLW, 1*HR,SUN,OCT29, HR> ; United Kingdom
AWEu AlgE <"W_EU", 1*HR,SUN,MARLW, 1*HR,SUN,SEPLW, HR> ; West Europe
AMEu AlgE <"M_EU", 2*HR,SUN,MARLW, 2*HR,SUN,SEPLW, HR> ; Central Europe + SU
AEEu AlgE <"E_EU", 3*HR,SUN,MARLW, 3*HR,SUN,SEPLW, HR> ; East Europe
ALby AlgE <"LIBY", 2*HR,DAT,APR01, 1*HR,DAT,SEP30, HR> ; Libya
AEgy AlgE <"EGY ", 2*HR,DAT,MAY01, 1*HR,DAT,OCT01, HR> ; Egypt
ATur AlgE <"TURK", 1*HR,SUN,MARLW, 0*HR,SUN,SEPLW, HR> ; Turkey
AIsr AlgE <"ISR ", 2*HR,SUN,APR3W, 1*HR,SAT,AUG4W, HR> ; Israel
AIra AlgE <"IRAN", 2*HR,SUN,MARLW, 1*HR,SUN,SEP3W, HR> ; Iran
APRC AlgE <"PRC ", 2*HR,SUN,APR2W, 2*HR,SUN,SEP2W, HR> ; People Rep of China
AROK AlgE <"ROK ", 2*HR,SUN,MAY2W, 2*HR,SUN,OCT2W, HR> ; Rep of Korea
AAus AlgE <"AUS ", 2*HR,SUN,OCT24, 2*HR,SUN,MAR3W, HR> ; South Australia
ANSW AlgE <"NSW ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR3W, HR> ; New South Wales
ANZe AlgE <"NZE ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, HR> ; New Zealand
AlgData ends
;************************************************************************