Re: How to get TIME from NTP
- From: "Gerhard Gentele" <gfgentele@xxxxxxxxxx>
- Date: Sat, 15 Mar 2008 02:12:34 +0100
Hi Jan,
yes I know that XP is offering a timeserver option. The point is that I make
cash register programs for restaurants. On most of their touch registers we
have W2K running and W2K don't offers this button. Some of them use the so
called Orderman (device to order wireless). These handhelts a terminals that
are controlled from a statemachine program (you can control up to 10 devices
with one PC over a RS232 port). To have everywhere the same time was the
customers request. Since all the used programes are from us it would be the
most easy way to do it from the timestuff from the already running (VFP9)
application. Then nobody has to install anything (besides a new PRG EXE).
By the way. The Navi server kicket me out (there was now refreshings anymore
after a few experiments.
But look at this "forgotten secret" below: It gives the time from the
CAESIUM Timeserver in Braunschweig Germany (they make the time there
(smile)). The batch file below is doing the job perfect with WINDOWS-DOS
commands. The only not so nice effect is that written in VFP with the RUN
"!" command opens a DOSBOX and that don't looks to good. Second negative
effect is when the date of the PC don't matches the actual date it don't
updates the time. But for most (adjusting) needs it will do a good job.
Do you have any idea on how to pack this below UNVISIBLE (without the RUN
command) in foxpro?
rem getting time from Braunschweig PTB timeserver
echo off
cls
net stop w32time
rem The adress from the PTB server first adress is: ptbtime1.ptb.de and
second adress ptbtime2.ptb.de
rem one server is always running
NET TIME /SETSNTP:ptbtime1.ptb.de
w32tm -once
net start w32time
echo ATOMZEIT IN BRAUNSCHWEIG ABGEHOLT
rem pause
Greetings Gerhard
"Jan Bucek" <bucek.jan@xxxxxxx> schrieb im Newsbeitrag
news:uHMWNwChIHA.536@xxxxxxxxxxxxxxxxxxxxxxx
I have an idea to solve your problem: AFAIK Windows since XP has anis
option in Date/time settings to adjust regularly the computer time from
internet. If you let it run on at least one PC-server in your network,
you can synchro date/time of other PCs with this server.
And using DATETIME() or TIME() in your program you get the time adjusted
to your local conditions (Time Zone, DST).
Jan Bucek napsal(a):
Gerhard Gentele napsal(a):
Hello Jan,
it works fine - many thanks.
One last qestion:
Is there a ready made function to get daylight saving time for Germany
instead the UTC, without doing calculations based on the calendar and
time.
Sorry, I have never seen (and I have never needed) something like this.
I can recommend you to go to:
http://fox.wikis.com/wc.dll?Wiki~VisualFoxProWiki
and to write "time" into search box and to inspect the results of query.
I am sure you can find there many interesting issues.
Best regards
Greetings Gerhard
"Jan Bucek" <bucek.jan@xxxxxxx> schrieb im Newsbeitrag
news:O8uomcogIHA.4684@xxxxxxxxxxxxxxxxxxxxxxx
oie=createobject("InternetExplorer.Application")
oie.Navigate("http://tycho.usno.navy.mil/cgi-bin/timer.pl")
do while oie.ReadyState <> 4
doevents
enddo
cTime = oie.Document.Body.InnerText
oie.Quit()
? [returned:], cTime
cTime = substr(cTime, at(',', cTime) + 2)
cTime = substr(cTime, 1, at(chr(13), cTime) - 1)
cTime = alltrim(strtran(cTime, 'UTC', ''))
? cTime + ' - this is UTC time'
Gerhard Gentele napsal(a):
Hello everybody,using
I would like to get the UTC-TIME (universal time coordinated) via NTP
an MS OCX.
At the start of an application I just want to make sure that the time
available?set
correct.looks
Therefore the NTP should get asked in unicast mode. There a "request"
must
be send to get the time string as a reply (don't know how the request
like).
I think MSINET.OCX should get used to get the asked information.
Somewhere i read that I have to use the SNTP CLIENT OPERATION and not
the
NTP. The reason is that I use Windows 2000.
This is a real little "tricky know how" thing that everybody working
with
VFP could use.
Is somebody out there who has done the job already. Any help
Greetings: Gerhard F. Gentele
.
- Follow-Ups:
- Re: How to get TIME from NTP
- From: Jan Bucek
- Re: How to get TIME from NTP
- References:
- How to get TIME from NTP
- From: Gerhard Gentele
- Re: How to get TIME from NTP
- From: Jan Bucek
- Re: How to get TIME from NTP
- From: Jan Bucek
- How to get TIME from NTP
- Prev by Date: Re: VFP 9.0 + SQL2005
- Next by Date: Re: How to get TIME from NTP
- Previous by thread: Re: How to get TIME from NTP
- Next by thread: Re: How to get TIME from NTP
- Index(es):
Loading