Announcement

Collapse
No announcement yet.

Time over 4 minutes slow

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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
    Managing Director
    DPS Computing Limited

    - Massive update! (September 2011) - It's now not neglected!!
    - New Site (10/2009)

    Comment


    • #3
      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!

      Comment


      • #4
        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
        Managing Director
        DPS Computing Limited

        - Massive update! (September 2011) - It's now not neglected!!
        - New Site (10/2009)

        Comment


        • #5
          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";
          ?>

          Comment


          • #6
            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
            Managing Director
            DPS Computing Limited

            - Massive update! (September 2011) - It's now not neglected!!
            - New Site (10/2009)

            Comment


            • #7
              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.

              Comment


              • #8
                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
                Managing Director
                DPS Computing Limited

                - Massive update! (September 2011) - It's now not neglected!!
                - New Site (10/2009)

                Comment

                Working...
                X