Command line world clock in Python

I often want a simple terminal-based world clock for scheduling. I finally scratched my itch and wrote a little script using Python’s awesome pendulum library.

You can specify a time (using any string that pendulum can parse) or let it use local time. And unlike the bash script I had found and been using for a few years, it properly tracks day shifts across timezones. (This need arose from scheduling with folks in India.)

https://gist.github.com/reagle/499355b362bb43cf73285c2fc0f78f5a

❯ tz.py '16:30'
Asia/Calcutta        Oct-14 02:00AM | +0530 || 17 18 19 20 21 22 23 00 01 02 03
Etc/UTC              Oct-13 20:30PM | +0000 || 12 13 14 15 16 17 18 19 20 21 22
Europe/London        Oct-13 21:30PM | +0100 || 13 14 15 16 17 18 19 20 21 22 23
America/New_York     Oct-13 16:30PM | -0400 || 08 09 10 11 12 13 14 15 16 17 18
America/Chicago      Oct-13 15:30PM | -0500 || 07 08 09 10 11 12 13 14 15 16 17
America/Denver       Oct-13 14:30PM | -0600 || 06 07 08 09 10 11 12 13 14 15 16
America/Los_Angeles  Oct-13 13:30PM | -0700 || 05 06 07 08 09 10 11 12 13 14 15

Comments !

links

social