Reincarnated.1754:

[API Suggestion] Server Time

It would be nice to have Server Time added to the API list.

I have noticed that many events and NPC placement are now on scheduled times.

When creating an interactive map that people from different time zones use.
I thought it would be easier to use one clock that’s the same for every one, rather than have to incorporate script to work out where the person using the map is located.

Just a thought)

Lawton Campbell.8517:

Eh, server time is just UTC. I would assume that the servers have an NTP client running, so there shouldn’t be that big of a sync issue between the GW2 servers and your local machine.

StevenL.3761:

Try this: http://www.timeapi.org/utc/now

There is a use case for something like this. For client applications, the operating system’s clock is not necessarily accurate when compared to the game’s clock.

Reincarnated.1754:

Eh, server time is just UTC. I would assume that the servers have an NTP client running, so there shouldn’t be that big of a sync issue between the GW2 servers and your local machine.

I don’t think you got what I was trying to say.

If people from different time zones have access to the same schedule, they have to do some calculation to work out the time on the schedule to there time.

If an application had access to the to the time the schedule was based on, then the application could easily do the calculation for each person in there respective time zone.

StevenL.3761:

What do you mean by schedule? If you mean boss rotations and daily resets, then those are all UTC-based. So you only need the current UTC time and the current timezone’s offset (relative to UTC) to calculate a localized schedule.

smiley.1438:

If people from different time zones have access to the same schedule, they have to do some calculation to work out the time on the schedule to there time.

In this case, those people should rather try tools like this one: http://everytimezone.com/

Reincarnated.1754:

Oh forget it, I got the same type of feedback when I suggested having different colour commander tags over 2 years ago.

I thought the idea of a good application was the user did as little as possible.

Not have to look up there time zone offset and do calculations in there head.

Anyways, I assume from this post now, that Server Time = UTC (Coordinated Universal Time.)
Is this the case for European Servers and American Servers?

At the moment my application requires that the user inputs there time zone offset from GMT. (obviously they only do this once and it’s saved as a setting).
I just converted all the scheduled times to GMT times add the value the user inputs and return the result.

I could have at the application at start up, go to a THIRD PARTY web server and find the current GMT, check the clients current time, calculate the difference and add that time to the scheduled time. (Obviously it would only calculate the difference once)

All I thought was instead of using a THIRD PARTY server, we could keep it in the family so to speak and ask GW2 API for the current server time.
The result would be compared to the clients time and the schedule adjusted to suit.

It was just a though, I must stop having these

StevenL.3761:

For pure client-side applications, use the operating system’s time zone setting.
Is your application written in HTML/JavaScript? In that case, asking for user input IS actually the right thing to do.

By the way, the GW2 API is also a third party server. The user’s client app is the first party. Your server is the second party. Any other server is third party.

Dr Ishmael.9685:

Actually Steven, you don’t need user input at all if you’re using JS – there’s a built-in function for this.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset

We use it on the wiki, in the function autoConvertUTC() in conjuction with Template:UTC time.

Reincarnated.1754:

Actually Steven, you don’t need user input at all if you’re using JS – there’s a built-in function for this.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset

We use it on the wiki, in the function autoConvertUTC() in conjuction with Template:UTC time.

This is my favourite saying:
If you haven’t learnt something new today, then the day has been wasted.

Thank you.
I don’t program professionally, so I tend to get tunnel vision some times
Off to see if Basic has a similar function.

I guess admin can close this post now