Obtaining current time from a website

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gshepherd7
Forum Newbie
Posts: 3
Joined: Tue Jun 26, 2007 2:42 pm

Obtaining current time from a website

Post by gshepherd7 »

I have a script that locks out users based on the current time. My site is hosted by a third party and the server time is never accurate. Is there any other way that I can get the current time? From a website, network time protocol, etc...


Thanks for the help,

Guyy
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

The server time is inaccurate? Have you tried talking to the provider?
gshepherd7
Forum Newbie
Posts: 3
Joined: Tue Jun 26, 2007 2:42 pm

Post by gshepherd7 »

Yeah, but that's at least a 24-48 hour turnaround. I need this to be as rock solid as possible.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Use one of the nuclear clock time servers.
gshepherd7
Forum Newbie
Posts: 3
Joined: Tue Jun 26, 2007 2:42 pm

Post by gshepherd7 »

How do access those time servers?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Using NTP.

http://www.php-editors.com/contest/1/6-read.html may be useful, although I haven't used it.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

But of course each request to a ntp server will take time.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

If you need rock solid performance, have you though of upgrading hosts?
Post Reply