BBS: Inland Empire Archive Date: 10-31-92 (12:55) Number: 342 From: DOUG RICKARD Refer#: NONE To: ALL Recvd: NO Subj: Set PC clock to AOTC Conf: (2) Quik_Bas
100 REM
REM Program name :-
REM SETIME.BAS
REM
REM Version:-
REM 1.01
REM
REM Author :-
REM Doug Rickard 07-3458717
REM Software Technologies Pty Ltd
REM PO Box 127
REM COOPERS PLAINS QLD 4108
REM AUSTRALIA
REM
REM Date:-
REM 29-Oct-1992
REM
REM Function :-
REM This program will ring the AOTC ASCII time service and set
REM the clock on the PC to the correct time and date.
REM In line 1000 you must change COM2: to the com port to which
REM your modem is connected.
REM In line 1100 you must change the telephone number to
REM correspond to the closest time service to you. Currently
REM these time services are only available from Brisbane
REM (07-2217033) and Melbourne (03-6001641).
REM Keep in mind daylight saving!
REM
REM Environment :-
REM MS-DOS V5.0 and MS-QBASIC
REM
REM Invocation :-
REM C:> QBASIC/RUN [path]SETIME.BAS
REM
REM History :-
REM V1.00 29-Oct-1992 Doug Rickard
REM Original version.
REM V1.01 30-Oct-1992 Doug Rickard
REM Fix for daylight saving changes in AOTC format.
1000 REM Open the COM port for full duplex I/O.
OPEN "COM2: 1200,N,8,1" FOR RANDOM AS #1
PRINT
PRINT "SETIME V1.01 30-Oct-1992 Set PC clock to AOTC time. Doug Rickard."
PRINT
REM Now send the dialing string to the modem.
1100 PRINT #1, "ATDT2217033"
1200 REM Check responses from modem until we get a CONNECT message.
INPUT #1, A$
REM PRINT A$
IF A$ = "CONNECT 1200" THEN GOTO 2000
IF A$ = "BUSY" THEN
PRINT A$
SYSTEM
END IF
IF A$ = "NO CARRIER" THEN
PRINT A$
SYSTEM
END IF
REM PRINT "Received "; A$; " from modem."
GOTO 1200
2000 REM This is the main loop where we receive the time string from AOTC,
REM validate it, and if ok then set the PC clock.
PRINT " PC time before correction is "; DATE$; " "; TIME$
PRINT
C% = 0
2010 INPUT #1, A$
IF A$ = "NO CARRIER" THEN GOTO 3000
REM Set a flag if it is a valid string we received.
F% = 0%
IF MID$(A$,20,1) = "*" THEN F% = 1
IF MID$(A$,20,1) = "#" THEN F% = 1
L% = LEN(A$)
2500 REM If string seems valid and is the right length then set clock.
IF (F% = 1) AND (L% = 20) THEN
REM Set the time.
TIME$ = MID$(A$, 12, 8)
REM Set the date.
DATE$ = MID$(A$, 6, 2) + "-" + MID$(A$, 9, 2) + "-" + MID$(A$, 1, 4)
REM Print out both times.
PRINT "AOTC time is now "; A$
PRINT " PC time is now "; DATE$; " "; TIME$
PRINT
END IF
C% = C% + 1
REM Loop back until we have done it correctly 5 times.
IF C% < 5 THEN GOTO 2010
3000 SYSTEM
9999 END
--- Maximus 2.01wb
* Origin: Brisbug PC User Group BBS (3:640/821)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET