473,425 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Server time

Hi,
let's say that my server time is for some reason incorrect! Is there a php
function that would automaticly correct that time (give or take a few
minutes, hours, days...) so date() function would return real
time/date!!

Thanks,
Ivan

--
EOF
Jul 17 '05 #1
2 11082

"Ivan" <de******@flyAWAY-SPAM.srk.fer.hr> schreef in bericht
news:sl*********************@fly.srk.fer.hr...
Hi,
let's say that my server time is for some reason incorrect! Is there a php
function that would automaticly correct that time (give or take a few
minutes, hours, days...) so date() function would return real
time/date!!

Thanks,
Ivan

--
EOF


As alternative you can play some with atomic times obtained from
timeservers:

The script below displays the 'real' time obtained from a timeserver and the
servertime on the providers server....

<?php

$server = "time.nist.gov";

$fp = fsockopen($server, 37);

$time = fread($fp, 4);

fclose($fp);

echo "Timestamp timeserver: ".hexdec(bin2hex($time))."<BR><BR>";

echo "Local timestamp on server provider: ".(time() +
2208988800)."<BR><BR>";

echo "Atomic time: ".strftime("%c", hexdec(bin2hex($time)) -
2208988800)."<BR><BR>";

echo "Local time on server provider: ".strftime("%c", time())."<BR><BR>";
?>

Marcel
Jul 17 '05 #2
Ivo
"Ivan" <de******@flyAWAY-SPAM.srk.fer.hr> wrote in message
news:sl*********************@fly.srk.fer.hr...
Hi,
let's say that my server time is for some reason incorrect! Is there a php
function that would automaticly correct that time (give or take a few
minutes, hours, days...) so date() function would return real
time/date!!


Perhaps your server is in a different timezone that you are?
If this is the case, simply adding/substracting the appropriate number of
hours will work as long as daylightsavingtime doesn't change at different
times in your respective zones.
Ivo
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dan glenn | last post by:
Say, I want to set a cookie and have it expire an hour after it's set. It's looking like this is only possible for browsers which are in the same time zone as my server?? In other words, if I...
2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
5
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of...
4
by: Phil Grimpo | last post by:
I had previously explained this problem in a different thread, but now that I have an IISState log, I figured I'd re-start the thred. My situation and the log are following... I have a very odd...
15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
8
by: swell | last post by:
I would like to write a server with the low level API of python ( socket+select and/or socket+thread ) that allow me to register client and update them every X seconds ( could be the time, the...
2
by: seb | last post by:
Hi, this simple server (time protocol) does not respond after a few hours, even when it is restarted. The behaviour looks to me like a firewall blocking but I have desabled the firewall. Using...
14
by: ahlongxp | last post by:
Hi, everyone, I'm implementing a simple client/server protocol. Now I've got a situation: client will send server command,header paires and optionally body. server checks headers and decides...
1
by: danfolkes | last post by:
Hey Everyone, I am trying to send repeated messages from a "Node" to a "Server". It works the first time I send the from the Node to Server, but after that it either errors, or does not do...
1
by: Jean-Paul Calderone | last post by:
On Fri, 21 Nov 2008 00:20:49 -0200, Gabriel Genellina <gagsl-py2@yahoo.com.arwrote: If you want to try this program out on POSIX, make sure you change the time.clock() calls to time.time() calls...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.