Dismiss Notice
Wynncraft, the Minecraft MMORPG. Play it now on your Minecraft client at (IP): play.wynncraft.com. No mods required! Click here for more info...
Dismiss Notice
Have some great ideas for Wynncraft? Join the official CT (content team) and help us make quests, builds, cinematics and much more!

Website & Forums Api: Express Times In Unix Timestamp

Discussion in 'General Suggestions' started by meadow, Nov 4, 2018.

?

Yeet or neet

  1. Yeet

    13 vote(s)
    100.0%
  2. Neet

    0 vote(s)
    0.0%
Thread Status:
Not open for further replies.
  1. meadow

    meadow STILL #1 AS warrer // Abusing databases since 2018 CHAMPION

    Messages:
    208
    Likes Received:
    164
    Trophy Points:
    67
    Guild:
    Minecraft:
    If you're not developing anything around the API then this is probably unrelated to you. But I still want to mention that here because I develop stuff around wynn's API :D

    So here are a few reasons that why the API should express times in unix timestamps instead of nicely formatted strings such as "2018-11-02 13:50:22"

    Reason 1: Confusing timezones.
    I actually have to dig around a bit to find out that the time strings are formatted as in GMT-4, and it changed to GMT-5 earlier today, causing confusion. Having to hardcode it's timezone is also a bad practice.

    Reason 2: Unnecessary work for us developers.
    As we know, almost every language comes with libraries that formats a unix timestamp into neat strings, so we can display them properly to our end users. But with a formatted string, we actually have to parse that string and convert it to a timestamp in order to store the correct time (I don't want everything in my database to be 12/13 hours off and so does the others). That's extra work for us.

    The solution is really simple: whenever an API response contains a time, such as last join, also put in a timestamp. Like the field "last_join" should be accompanied by another field "last_join_ts". This maintains backward compatibility.
     
  2. Cloud Man

    Cloud Man Bruh HERO

    Messages:
    1,008
    Likes Received:
    929
    Trophy Points:
    128
    Minecraft:
    I do agree, it’d be so much easier to manage timezones when I’m working with the api.+1
     
  3. meadow

    meadow STILL #1 AS warrer // Abusing databases since 2018 CHAMPION

    Messages:
    208
    Likes Received:
    164
    Trophy Points:
    67
    Guild:
    Minecraft:
    Colin likes this
    upload_2018-11-19_2-35-1.png
     
  4. Sockmower

    Sockmower Be excellent to each other CMD

    Messages:
    185
    Likes Received:
    756
    Trophy Points:
    73
    Minecraft:
    Doesn't the `request` parameter contain a timestamp or is it a date? Nonetheless a good idea, +1
     
  5. meadow

    meadow STILL #1 AS warrer // Abusing databases since 2018 CHAMPION

    Messages:
    208
    Likes Received:
    164
    Trophy Points:
    67
    Guild:
    Minecraft:
    There are still some parameters that are nicely formatted like territory acquired time and first/last join times
     
Thread Status:
Not open for further replies.