Close

As with comedy, timing is everything

A project log for Tide Clock in MicroPython

Showing times of upcoming high/low tides using a WiPy and an E-Paper Display to try MicroPython in a project

stephen-bStephen B 01/27/2017 at 10:251 Comment

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:

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

[deleted]

[this comment has been deleted]

Stephen B wrote 01/27/2017 at 20:01 point

I didn't try, sorry.  There's no C in it, so it might work?

  Are you sure? yes | no