Domanda

I have a network of sites which comminicate to eachother all sorts of events and functionality.

Having a combined analytics system, I realized the need for a central clock, to put them all, perfectly, on the same schedule down to the millisecond.

Right now I'm using a typical timestamp format:

<?php date('Y-m-d H:i:s') ?>

This is different for all servers, of course. I was hoping to achieve a way to get that very same 'Y-m-d H:i:s' from an online, central clock or service.

Does such a thing exist? It should be as reliable as getting jquery from google.


Its with pain that I write this, I simply cannot stop myself from compulsively asking this knowing it will get a downvote! But it is a serious issue and good question!

È stato utile?

Soluzione

You can sync with NTP. NTP is a central clock, where various computers can get their time from.

So, you can either set all your machines to get their time from a single NTP server, or just use a PHP NTP client to pull the time from a central clock. Your call. Check out an example here: http://xlo.co/blog/general/php-ntp-client

Is this what you are looking to do?

Altri suggerimenti

You have to query a time server for that. These servers/communication use the Network Time Protocol to give a unified time across global network of computers.

Check http://www.ntp.org/

As far as querying these servers are concerned, it is a normal fsockopen

Maybe this SO answer will help you as well

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top