Actually I'm talking about time zones.I finished this project in early March 2016, handed the gift over and hoped that I would not be supporting a one-off gift for the rest of my life. Then the clocks in the UK moved forward an hour.
Shit.
The micropython board does not understand time zones, and without retrieving it across the country, never will. So the server must, and translate. In a problem mirroring Unicode handling in Python 2, I solved this by marking each time source with a timezone using the Python library pytz, and then translating time data between time zones.
This seemed simple but no source explicitly records time zone information - I'm using:
- An XML API
- An HTML page I'm scraping with beautiful soup
- Stored data in XML (regretted that pretty quick)
- Stored data in JSON
And all need to have time zone information added back. 'Ware time zones!
If that wasn't enough, around 31st December a forgotten TODO in my code came back to bite me. The tide information I scrape doesn't actually include the year. "That's alright," I said, "I'll assume it's the current year". This is not true of course at the end of the year where all future tides are in the next year. In theory this would sort itself out on New Year's Day but I decided to fix it with a year increment when Dec rolls to Jan on the page.
I frantically fixed this before remembering the clock has been turned off for two months while my step mother is on a cruise. Ho ho ho.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
[this comment has been deleted]
I didn't try, sorry. There's no C in it, so it might work?
Are you sure? yes | no