1. Find your external IP address.
That only works in the simple case of a machine that has a single IP connection. While the bulk of all desktop machines are configured that way, it doesn't have to be true. Many servers have multiple interfaces, and multiple IP addresses. Sometimes even more IP addresses than interfaces. Some machines have no outgoing interfaces at all (they are air gapped), or have multiple.
In my previous employer, all our internal machines were proxied. We had at least two outgoing proxies, one in California, one in New York, with a very fast internal network connecting them, and the two of them were load-balanced (so most of the time I used the California one, but if it was down or overloaded, my traffic went via New York). So if you tried to determine your internal IP address, you could get wrong by 3 hours of time zone difference.
But for the simple cases where a machine has only one outbound connection and no proxy, the simplest method is indeed what obsigna posted: There are many web servers that will read your IP address back to you. If you have a web server somewhere, this is trivial to implement, with a 3-line CGI script in python: just print out "os.environ[remote_addr]".
So the programmatic way is to query a server that reads back your address to you.
2. Find the location of the IP address - country should be sufficient.
In some cases that would work by geolocating (from the latitude-longitude coordinate). If you search for "geolocating IP address", there are many services that do that for free. You would have to fetch their page with your IP address from step one programmatically (easy, can be done with fetch or wget), then parse and decode the HTML output (can be done with a HTML DOM parser, I know they are available in python). It would probably take an experienced programmer a few hours to code this so its reliable enough to be production worthy.
The other option is what ShelLuser and obsigna posted: instead of using geolocation, use the registration information of your IP address, through whois.
Also, sometimes I'm in the UK and sometimes GB which makes life confusing.
And those are the example of the special cases that would either need a lot of programming, or have the user check the result and override. What if you are on the Island of Man? How about Gibraltar? Those are part of the UK or of GB, or perhaps not. And they are either in the same time zone or not.