#!/usr/bin/env python3 """CGI script to print the current date and time in various time zones. The time zones that you want to generate are stored in "zones", which is a list of tuples of (1) an arbitrary label for the zone and (2) the value that the operating system expects for its environment variable TZ. """ __version__ = 'v1.4' __initialdate__ = 'January 2006' __author__ = 'Darren Paul Griffith, https://www.madphilosopher.ca/' # The following is the list of time zone labels and their respective # value for the environment variable TZ: # # ("Label", "TZ value") # # The label can be anything. For the environment variable, # use the filenames found in the directory: # # /usr/share/zoneinfo # # in Linux or FreeBSD. # ZONELIST = [] ZONELIST.append(("Vancouver", "PST8PDT")) ZONELIST.append(("Edmonton", "MST7MDT")) ZONELIST.append(("Sask.", "Canada/Saskatchewan")) ZONELIST.append(("Ottawa", "EST5EDT")) ZONELIST.append(("Halifax", "AST4ADT")) ZONELIST.append(("St. John's", "America/St_Johns")) ZONELIST.append(("UTC", "UTC")) ZONELIST.append(("Berlin", "Europe/Berlin")) ZONELIST.append(("Beijing", "Asia/Shanghai")) ZONELIST.append(("Singapore", "Asia/Singapore")) ZONELIST.append(("Canberra", "Australia/Canberra")) # The beginning of the output for the cgi script, # including the all important first line (Content-type) # and second blank line. HEAD="""Content-type: text/html
| Zone | Time |
|---|
{command_output}