Server-side Time Refresh

Source: Internet
Author: User
Mobile Game server Front end

The younger brother is doing the hand swims wants to consult under
Front-end Request my server-side time
I should have passed it to him. Current time on server side
So I should always refresh myself so how to refresh in real time
What's the plan?
Need to use as little resources as possible


Reply to discussion (solution)

I do not understand, PHP inside directly with the time () function can not directly get the current time timestamp? Then format the output to the front end with date ()

What's the inside of it?

Because the game time to go server time can not walk the client so to the server to refresh time to the front end
Go to the client to change the time of the mobile phone is equal to the game time, it is nonsense
For example, some games let you draw a prize every day and then suggest that the next draw is still xx hours xx minutes xx seconds
This time is on my side, server side.
Figuratively speaking: The front end asks me every time. "I have to tell him," or "not." If he asks me once in a while, I have to refresh my time to catch up with the frequency of his request .... That's probably what it means.

Your "visualization" also is a solution, but not you refresh time (time is objective) but you show it in your way
This is not usually the case, but it is the time to start sending the server to the user to calculate the time difference between the user and the server. This kind of JS Countdown code a lot, you can go to find

The big version is right.

And you can actually "get the prize" and then judge whether it's within the time frame.

Time () on the server should always be the current server, right? @xuzuning

Just asked the next chief, he said. A batch file Bat file
What stop what Loop: This is a plan, okay?

The big version is right.

And you can actually "get the prize" and then judge whether it's within the time frame.

Time () on the server should always be the current server, right? @xuzuning

Time () Gets the times of the server. Can do this: the beginning of the server time to pass through, and then in the verification of the time to the server, the client side how Paddy does not matter, after all, determine the success of the key factors in the hands of the server.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.