TIME FROM SERVER (AREV Specific)
At 09 FEB 2009 02:40:17PM R.H. Nootens wrote:
At 10 FEB 2009 11:34PM Eric Emu wrote:
If you want to get the time from a web-based time server, OI is the only platform capable of supporting sockets in this way.
AREV doesn't support sockets from a DOS session, but *could* conceivably call a 32 bit VB application executable which returns the time from a time server and writes it to a file.
Revelation Software have in their possession the OI routines to provide this functionality - if it isn't already a part of the current OI release.
At 11 FEB 2009 03:09PM Bob Carten wrote:
Eric is correct - OI has a function named GetWebTime that will return the date and time that will return the date and time. It exists in 8.07 ( and probably since 7.0 ) but we never documented it.
Thanks for pointing it out Eric. You do good work.
usage:
declare function getwebtime
webdatetime=GetWebtime(server_nr)
webdate=webdatetime
webtime=webdatetime
where server_nr is an optional parameter which is the index of the server to choose from the following list.
"time-a.timefreq.bldrdoc.gov"
"time-b.timefreq.bldrdoc.gov"
"time-c.timefreq.bldrdoc.gov"
"utcnist.colorado.edu"
"nist1.datum.com"
"ntps1-0.uni-erlangen.de"
"ntps1-1.uni-erlangen.de"
"ntps1-2.uni-erla ngen.de"
"ntps1-0.cs.tu-berlin.de"
"time.ien.it"
"ptbtime1.ptb.de"
Also, google the Microsoft NET TIME function. You cam use that to set your machine time from a global time source, then use the Arev TIME functions.
- Bob
At 12 FEB 2009 01:55AM Eric wrote:
Bob,
The time server list might be externalized for the next release - some of those egg timers had all the sand run out.
The existing function I think also works with the server name - go to wikipedia, find a time server, then test the function with
result=getwebtime("my-time-servername.com")
At 12 FEB 2009 02:02AM Eric wrote:
You may also need to open port 37 on the firewall. It's the one that moves the sand across the interweb thingy.
At 12 FEB 2009 02:14AM Eric wrote:
But a helpful bunch of people have decided that finding the time was an abuse of the time servers (huh?) and so have encrypted / passworded / chained / shackled / and MD5 keyed the time.
http://groups.google.com/group/comp.protocols.time.ntp/browse_frm/thread/fc51c6ee6ad66f66
Sorry, your honour, but I was late because the packet Nazis made me.
At 12 FEB 2009 05:14PM Ralph Johler wrote:
IF you are using a Novell server, Steve Smith had a utility called SYNCTIME that does this.
I don't know if this is still available however.
Anyone?
At 13 FEB 2009 06:24AM Eric wrote:
Uses the old DOS-style Novell API calls which probably aren't supported any longer.
; SYNCTIME
; By S. Smith 22/04/97. Designed as an AREV subroutine to synchronize
; the workstation and Novell server date & time
;————————————————————————–
CSEG SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:CSEG
ROUTINE PROC FAR
ORG 0 ; START AT ADDRESS ZERO.DB 'ASSM' ; 4-BYTE FLAG.DB 2 ; IDENTIFY AS ASSEMBLY ROUTINE.NO_ARGS DB 0 ; NUMBER OF ARGUMENTS PASSED.
NO_COMS DW 0 ; NUMBER OF COMMON VARIABLES.
DW 0 ; UNUSED.FUNCTION DD 0 ; ADDRESS FOR REV FUNCTION CALLS
;————————————————————————–
start: jmp begin
replybuf db 8 dup (0)
begin: mov dx,cs
mov ds,dxmov ah,0E7hmov dx,offset replybufmov si,dxint 21h ; get file server; date & timemov cx,1900Dadd cl,byte ptr ds:si ; yearmov dh,byte ptr ds:si+1 ; mthmov dl,byte ptr ds:si+2 ; daymov ah,2Bh ; set DOS dateint 21hmov ch,byte ptr ds:si+3 ; hrmov cl,byte ptr ds:si+4 ; minmov dh,byte ptr ds:si+5 ; secmov dl,0h ; hundredthsmov ah,2Dh ; set DOS timeint 21hret ; return to AREVroutine endpCSEG ENDS
END
At 13 FEB 2009 08:06AM Kauko Laurinolli wrote:
How to catch an error if
webdatetime=GetWebtime(server_nr)
is unable to connect?
At 13 FEB 2009 04:27PM Eric wrote:
The idea is that time servers exist or don't exist. When you connect to a time server that doesn't exist, the routine waits to see if someone will invent the time server. This is a pre-emptive approach. Most socket servers work on a multi-threaded "apartment" model. This program works on a single-threaded "live-in-the-basement" model. Much cheaper. The problem is that so many application developers started opening connections to time servers that the atomic clocks grew tired of emitting the odd particle and shut down all together. You should read more about the problems of connecting to atomic clocks in the following article:
http://uncyclopedia.wikia.com/wiki/Polonium_210
Another idea is to check the time between calls to getwebtime() and if it's advanced more than a second, you've connected to a non-existent clock.
start=time()
now=getwebtime(server)
end=time()
if (end-start) ] 1 then
non existent clockend else
existent clockend
Of course, getting the time zone from the local PC is another problem all together. If everyone moves to Greenwich to use your application you can save a lot of programming time.
At 13 FEB 2009 04:46PM Victor Engel wrote:
Today in unix time format it will be 1234567890 (less than 2 hours from now as of this writing).
At 18 FEB 2009 09:19AM Jared Bratu wrote:
If your workstations are part of the Active Directory they should automatically update the time from the domain controller using the W32Time service.