Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2008
    Posts
    4

    Default Time over 4 minutes slow

    I'm using the following code to return the time & date and am finding it about 250 seconds slow (over 4 minutes). Is the time incorrect on the PHP server?

    putenv("TZ=Europe/London");
    $time_now = time();
    $date = date("D, j M Y H:i:s",$time_now);
    echo "Date = $date";

  2. #2
    Join Date
    Apr 2007
    Location
    Manchester, United Kingdom
    Posts
    8,440

    Default

    As far as I know the time(); function gets the time from the servers clock - so this would make it a server issue .
    David Smith
    DPS Computing
    http://www.dpscomputing.com (Computing, Reviews, News) - We're still plodding on adding new content and features (August 2011)
    http://www.djdavid.co.uk - Massive update! (September 2011) - It's now not neglected!!
    http://davidsmith.dpscomputing.com (My Personal Website) - New Site (10/2009)

  3. #3
    Join Date
    Nov 2008
    Posts
    4

    Default

    Are you able to reproduce the problem? There's nothing wrong with my coding is there?

    If it was a time zone problem I would have expected the error to be a multiple of one hour, not 250 seconds!

  4. #4
    Join Date
    Apr 2007
    Location
    Manchester, United Kingdom
    Posts
    8,440

    Default

    Are you testing this on a shared account? Or is this local testing on your computer? If its local testing then its your own computers clock that is incorrect. If your testing it on a shared account that you have with eUKhost then it is the servers time that is incorrect (this could be by minutes, seconds, hours, days, years).
    David Smith
    DPS Computing
    http://www.dpscomputing.com (Computing, Reviews, News) - We're still plodding on adding new content and features (August 2011)
    http://www.djdavid.co.uk - Massive update! (September 2011) - It's now not neglected!!
    http://davidsmith.dpscomputing.com (My Personal Website) - New Site (10/2009)

  5. #5
    Join Date
    Nov 2008
    Posts
    4

    Default

    Okay, so the server time may be incorrect, but I've run similar code with other hosts and not had a problem. 250 seconds seems an awful lot out for a professionally hosted site. I'd expect it to be accurate to within one second.

    I've uploaded the code to a eUKhost site. Here's the URL

    [URL="http://www.bizdotbizdotbiz.biz/stockchallenge.co.uk/date.php"]

    The code is:

    <?
    putenv("TZ=Europe/London");
    $time_now = time();
    $date = date("D, j M Y H:i:s",$time_now);
    echo "Date = $date";
    ?>

  6. #6
    Join Date
    Apr 2007
    Location
    Manchester, United Kingdom
    Posts
    8,440

    Default

    Quote Originally Posted by Typo56 View Post
    Okay, so the server time may be incorrect, but I've run similar code with other hosts and not had a problem. 250 seconds seems an awful lot out for a professionally hosted site. I'd expect it to be accurate to within one second.

    I've uploaded the code to a eUKhost site. Here's the URL

    [URL="http://www.bizdotbizdotbiz.biz/stockchallenge.co.uk/date.php"]

    The code is:

    <?
    putenv("TZ=Europe/London");
    $time_now = time();
    $date = date("D, j M Y H:i:s",$time_now);
    echo "Date = $date";
    ?>
    You may have run similar code on other hosts, but that will have been on a different server. If there server time is correct, the correct time will appear with time() if its incorrect then it will display incorrectly.

    If I set my server time to say its 1978 and run the time(); on my server the date will return as 1978.

    I have used your code on one of my sites. The link to the page is here (I will leave it up for you to look at and verify) -----> http://www.dpscomputing.com/date.php

    As you can see, the time is correct using the script on my site, as my server time is set correctly.

    If this is on a shared account you will have to contact support (either support[@]eukhost.com or via LiveChat from the main eukhost.com website) and see if they can change the server time as it is definitely an issue with the time on the server you are hosted on rather than a general time problem or a problem with the code.

    Hope that helps . (and do keep us posted on how you get on! ).
    David Smith
    DPS Computing
    http://www.dpscomputing.com (Computing, Reviews, News) - We're still plodding on adding new content and features (August 2011)
    http://www.djdavid.co.uk - Massive update! (September 2011) - It's now not neglected!!
    http://davidsmith.dpscomputing.com (My Personal Website) - New Site (10/2009)

  7. #7
    Join Date
    Nov 2008
    Posts
    4

    Default

    Thanks. I make your link 5-6 secs slow, nothing like my 250 secs. Is your site hosted by eUKhost too?

    I'll wait until next week when the techie returns. Let him sort it out from here.

  8. #8
    Join Date
    Apr 2007
    Location
    Manchester, United Kingdom
    Posts
    8,440

    Default

    Quote Originally Posted by Typo56 View Post
    Thanks. I make your link 5-6 secs slow, nothing like my 250 secs. Is your site hosted by eUKhost too?

    I'll wait until next week when the techie returns. Let him sort it out from here.
    No problem - well yes, its possibly not perfect, but more than sufficiently accurate for my sites and my customers. I am hosted with eUKhost but I am a dedicated server customer - so I have my own server and as such can do things like set the time. As a shared hosting customer, you need eUKhost technical support to do this for you as you have no access to the server settings.

    Hope that helps .
    David Smith
    DPS Computing
    http://www.dpscomputing.com (Computing, Reviews, News) - We're still plodding on adding new content and features (August 2011)
    http://www.djdavid.co.uk - Massive update! (September 2011) - It's now not neglected!!
    http://davidsmith.dpscomputing.com (My Personal Website) - New Site (10/2009)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •