Timezones

Sort:
Avatar of waltertamboer

How does the API deal with timezones? I'm in Europe and every now and than I receive a message that I cannot download games with a date in the future. This happens around the first of the month so I'm guessing this is a timezone problem?

Avatar of skelos

All timezones I've seen have been in UTC, in seconds since the Unix epoch: 1970-01-01 00:00.

I'm in Australia (UTC+11) so should be further ahead of you than you are of USA PST (UTC-8 or something, depending on daylight savings time).

What endpoint are you using that gives the error?

Avatar of skelos

My downloads are usually players' archives: look up the archives, pull them down. I've not seen any such error.

Avatar of andreamorandini

@waltertamboer all timestamps are UTC as well noted by @skelos. And as suggested by him the best approach is to first get the list of available players' archives.

Avatar of bcurtis

The servers are in California, and due to all of our old data being recorded in that time zone, when we have to pay attention to time zones (like determining when a new month begins), that's the time zone that we use.

We are in the process of updating the data storage, and in so doing we hope to be able to become more "global" than that. But it will be a slow process since things like this API need to stay compatible with our older data.

Avatar of skelos

If I'm re-downloading a player's data, I:

  1. Assume current daily games are out of date
  2. Re-download the final archive file if it is the current month
  3. Also re-download the last archive file I have unless it was downloaded 72 hours or more into the following month.

Three days allows for California living in yesterday and a day's worth of caching (which archives may or may not be, I don't know) and a bit extra for safety.

Of course, it will break if/when the data available changes (username change, current & reported archive bug acknowledged and fixed, rated vs. unrated perhaps, although that might be in the JSON not the PGN).

Giles

Avatar of waltertamboer

Hmm I've noticed earlier that months were missing from the archives API, that's why I didn't use it. Probably that's fixed now so I'll change my code. 

@bcurtis - That's probably it. I downloaded games at the first of the month on 08:00 am. There is a 9 hour difference between the timezone of the servers and my timezone so basically I was requesting an archive in the future, the time on the server still was the 11 pm in the previous month happy.png

 

Thanks happy.png

Avatar of skelos

I filed a new bug report against the archives list a few days ago. sad.png Maybe it was fixed with the live games caching issue, or maybe it's different. There's a thread.