Exactly that was not useful to find the solution.
It was not a matter of defining
the time zones, but which syntax to use
I had the same problem - usually with most environments I'd use TZ="Pacific/Auckland" or sometimes ":Pacific/Auckland", which is what most timezone searches would reveal. But neither of those work here. Somewhere, after an hour of digging, I found I had to use "NZST-12NZDT,M9.5.0,M4.1.0/3". Not exactly obvious but at least it's explicit about daylight savings.
Also, to use UTC, you need to use "UTC0", or gmtime/gmtime_r().
Note that there's a fairly well known memory leak in setenv() which means that if you change timezones repeatedly, which you might do for an application that handles multiple time zones, you'll eventually run out of memory. I'm not sure if the environment is shared between tasks - if not, it might be better to have separate tasks for each timezone. If it is shared, then I'm not sure what the best way to deal with this is. In my case I worked out the difference between the two timezones and used that to calculate the second time.