Thread with 7 posts
jump to expanded postinteresting technical puzzle, perhaps an interview question: how would you convert a UNIX timestamp to a calendar date (YYYY-MM-DD)? with minimal research!
well, I now have my own answer to this :3 https://github.com/hikari-no-yume/touchHLE/commit/c94a8311fa8140068b7d187c34dfa3110955d31b
@saagar I did actually do a bit of research for this… I went to the Wikipedia page for the Gregorian calendar to check I remembered the leap year algorithm correctly, how long its cycles are, and also to remind me how long each month of the year is…
but the constants I ended up using can be trivially derived from things most people know (how long is a year, what is a leap year, how long is an hour, how long is a day)
@saagar ah, right, my particular kind of curious mind meant I already knew the answer to that (no) but most people wouldn't
@saagar I think, as an interview question, I wouldn't want to penalise someone for not knowing, it's just interesting to see how they go about trying to solve it considering what they do know