Autor Beitrag
Rainer Brechtken
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win2000
Delphi 6.0 Prof
BeitragVerfasst: Di 13.06.06 08:36 
Grüß Euch !

Ich habe folgendes Problem, ich möchte von einem Rechner aus die lokale Zeit auf mehrere über TCP/IP vernetzte Rechner übertragen. Geht das mit IDTime ? Es wäre schön wenn mir einer weiterhelfen könnte, vielleicht sogar mit einem kleinen Beipielprogramm.

Übrigens ein tolles Forum hier...

Rainer
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Di 13.06.06 08:42 
Ich nehme dazu kein Delphi, sondern das Anmeldescript für jeden Rechner vom Server
in dem steht:

net time \\server /set /yes

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
Rainer Brechtken Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win2000
Delphi 6.0 Prof
BeitragVerfasst: Di 13.06.06 09:30 
Danke für deinen Hinweis, aber soweit ich net time kenne holt sich doch net time die zeit von einem anderen Rechner oder ? Ich würde aber gerne von einen Rechner aus weitere Rechner syncronsieren, und das mit einem Timer alle 10 Minuten aktualisieren...

Gruß

Rainer
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Di 13.06.06 10:11 
user profile iconRainer Brechtken hat folgendes geschrieben:
Danke für deinen Hinweis, aber soweit ich net time kenne holt sich doch net time die zeit von einem anderen Rechner oder ?

Naja, für "Server" setzt Du Deinen Rechnernamen ein!
Zitat:
Ich würde aber gerne von einen Rechner aus weitere Rechner syncronsieren, und das mit einem Timer alle 10 Minuten aktualisieren...

Ist alle 10 Minuten nicht übertrieben?
Ich aktualisiere meinen Server einmal am Tag per Internet und alle Rechner beim Einschalten per Anmeldescript!

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
Rainer Brechtken Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win2000
Delphi 6.0 Prof
BeitragVerfasst: Di 13.06.06 11:04 
Ich will vermeiden, das sich die Rechner mehr als eine Sekunde voneinander entfernen....
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Di 13.06.06 13:07 
Dazu brauchen Sie aber sicher weit länger als 10 Minuten. Du solltest das eher an jedem Systemstart machen, da dort die Uhrzeit auf grund leerer Mainboard-Batterie die Uhrzeit stehen geblieben sein könnte. Das sollte sicher langen.

Gruß alias5000

_________________
Programmers never die, they just GOSUB without RETURN
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 13.06.06 13:13 
Moin!

Um mal Zahlen in die Diskussion zu bringen: AFAIK ist die typische Genauigkeit einer PC-Uhr 5ppm. Also geht (eine nicht defekte) PC-Uhr in 1.000.000 Sekunden um 5 Sekunden falsch. Entsprechende Zeitbezüge für Aktualisierungen lassen sich daraus dann ja ableiten. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Rainer Brechtken Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win2000
Delphi 6.0 Prof
BeitragVerfasst: Di 13.06.06 13:17 
Soweit die Theorie, allerdings habe ich als praktische Erfahrung bei dem Betrieb von 4 Rechner nach 8 Stunden Laufzeit Abweichungen bis zu 6 Sekunden.. und die will ich auf alle Fälle vermeiden...

Gruß

Rainer
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 13.06.06 14:35 
das kannst du mit den INDYs machen.
Da gibts Time Komponenten, die dir die PC Uhr mit einem Server im Internet abgleichen.
Es gibt auch Komponenten, die einen solchen Server bereitstellen.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Rainer Brechtken Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win2000
Delphi 6.0 Prof
BeitragVerfasst: Di 13.06.06 15:01 
Hallo Matze,

ein Internet server muß es gar nicht sein, es reicht wenn alle Rechner die gleiche Uhrzeit aufweisen. Hast Du eventuell Beispielcode für ein Setzen der Rechnerzeit mit Hilfe von Indy ?

Besten Gruß

Rainer
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 13.06.06 15:14 
nimm die INDY SNTP (glaub ich, dass die so heißt, ich hab kein Delphi da), die mit der Armbanduhr im Icon.
Setz den Host z.b. pool.ntp.org und ruf dann die methode syncTimeauf. Fertig.

Das ganze gibt es dann auch als Server. Da musst du dir nur die Hilfe anschauen !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Rainer Brechtken Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win2000
Delphi 6.0 Prof
BeitragVerfasst: Mi 14.06.06 09:30 
Ich komme leider mit der Hilfe nich weiter, ein Beispielcode wäre sehr hilfreich...

Rainer
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 18.06.06 21:39 
für was ? Client oder Server ?
Rainer Brechtken Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29

Win2000
Delphi 6.0 Prof
BeitragVerfasst: Di 20.06.06 14:44 
Hallo Matze,

ich würde gerne die lokale Zeit von Rechner 1 auf die Rechner 2,3,4,5 und 6 übertragen.

Gruß

Rainer
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Di 20.06.06 14:50 
Das ist klar, aber zeig uns doch schinmal deinen Ansatz (-code?). Dann können wir dir anhand dessen weiterhelfen

Gruß alias5000

_________________
Programmers never die, they just GOSUB without RETURN
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Di 20.06.06 14:52 
Am geschicktesten wäre es imho wenn auf Rechner 1 ein Server säße.
Dieser hat ne feste IP und kann somit ganz easy von den Clienten connected werden.
Du könntest, wenn du die Sockets nähmest, ganz einfach im OnConnect ereginis die Uhrzeit mit TimeToStr senden und bei deim Client mir TimeToDate wieder dechiffrieren und setzen.
Bsp:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
Klient:

Irgendwo:

ClientSocket1.Host:='festeip';
ClientSocket1.Port:=2223;
ClientSocket1.Open;

//Im Read:

Deine procedure zum Uhrzeitsetzen(StrToTime(Socket.ReceiveText));
//Fertig

Server:

ServerSocket1.Port:=2223;
ServerSocket1.Open;

//Im OnClientConnect
ServerSocket1.Socket.Connections[ServerSOcket1.Socket.ActiveConnections-1].SendText(TimeToStr(TIme));
//Auch Fertig

MfG Fighter#1

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 20.06.06 18:24 
Entweder du machst alles selber, oder du nimmst die Indy Kompos TidTimeClient und TidTimeServer.

Für den Server:
Nimm einfach die TidTimeServer Komponente und setzt die Eigenschaft activeauf true.

Für den Client:
Nimm die TidTimeClient Komponente, setzt die Eigenschaft Hostauf die IP Adresse des Rechners mit dem Server auf.
Mit idTimeClient1.syncTime; kannst du dann die PC Uhr mit dem Server abgleichen.
Mit idTimeClient1.DateTime kommst du an die Zeit des Servers.