Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Syncronising time on two (or more) computers

Author
Message
Killswitch
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: School damnit!! Let me go!! PLEASE!!!
Posted: 15th Jun 2004 20:55
For some time I've been working on a chat program, and I've been bugged with the problem of having to have a fixed server - it just wasn't practicle for my needs. But in a flash of inspiration during a particularly boring Maths lesson today I had an idea that scraps the server and sorts my problem out.

I'm slightly anxious about slow down with my program, as it spreads responsibilty out to everyone - each client sending on a message to two others.

So I want to test the program and check how fast messages are sent - but the problem is I need to have the exact same time on several comptuers at once. Is there an easy way to do so, or can you think of a better way of testing out speed?

~I see one problem with your reasoning: The fact is that is a chicken~
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Jun 2004 21:07
Ok, some crap deleted.

Do you really need synchronised times? The way most programs find out how long it takes to send a message, is to send a 'ping' message, wait for the reply to come back, and halve the total time taken.

Do this a few times and average the result, and you'll get quite accurate results.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 15th Jun 2004 21:09 Edited at: 15th Jun 2004 21:11
just get them to send messages to each other repeatedly and find the time between sends/gets, no need to syncronise timers, just record the time in msecs between 200 pings and take the average, the time will be the transmission time, you don`t need to know what time of the day it happened, just how long it took.

Mentor.

Edit: Ian M...stop looking over my shoulder when I`m typing LOL <jk>

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
Killswitch
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: School damnit!! Let me go!! PLEASE!!!
Posted: 15th Jun 2004 21:13 Edited at: 15th Jun 2004 21:14
Thanks IanM, for deleting my other post - Humble Guhill is just getting on my nerves.

As for your suggestion, it'd work well for a simple client-server set up, but what I'm trying to achieve is a web of clients that act as the server themselves.

It's a bit like this

Client 1 >>> 2
| |
4<<<<<3

~I see one problem with your reasoning: The fact is that is a chicken~
Killswitch
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: School damnit!! Let me go!! PLEASE!!!
Posted: 15th Jun 2004 21:15
Hmm.. that diagram doesn't work so well, is supposed to be a square formation.

@Humble: you would care if people are sending messages and your 30 seconds behind!!!

~I see one problem with your reasoning: The fact is that is a chicken~
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Jun 2004 21:33
I did see that the diagram was meant to be square

I guess what you are trying to do is provide a peer-to-peer chat program.

You could use a third-party site to get a timestamp from (such as a permanent timeserver somewhere) and synchronise that way, but apart from that, I don't have many suggestions.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2024-09-22 02:59:00
Your offset time is: 2024-09-22 02:59:00