Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


NIST Time Retrieval

Keywords: 	 NIST Time Retrieval

;constant is used to adjust time to local time zone
;a larger constant moves time back.  A smaller constant moves time forward
;constant is in one second increments
;constant=61530354    ;Pacific Daylight time
constant=61505154    ;GMT / UTC time
;Generally just add or subtract multiples of 3600 til you get the time you want

AddExtender("wwwsk34i.dll")

rc=''
socket = sOpen ()
if socket != @FALSE
   status=sConnect (socket, "time.nist.gov", "37")
   if status == @TRUE
      msg=sRecvnum(socket,4)
      sClose(socket)
      msg=(msg & 2147483647) - constant   ;what a hack job...
      msg=TimeAdd("1970:01:01:00:00:00","0000:00:00:00:00:%msg%")
      Message("Server Time is",msg)
      exit
   endif
   exit
endif
exit