zones = { "UTC0"                                 ...
          "EST+5EDT,M3.2.0/2,M11.1.0/2"          ... America/New_York
          "CET-1CEST,M3.5.0/2,M10.5.0/2"         ... Europe/Berlin
          "CLT+4CLST,M8.2.0/0,M5.2.0/0"          ... America/Santiago
          "LHST-10:30LHDT-11,M10.1.0/2,M4.1.0/2" ... Australia/Lord_Howe
          ":America/Caracas"                     ...
        };
TZ_orig = getenv ("TZ");
unwind_protect
  for i = 1:numel (zones)
    setenv ("TZ", zones{i});
    ## These specific times were chosen to test conversion during the loss
    ## of some amount of local time at the start of daylight saving time in
    ## each of the zones listed above.  We test all in each time zone to be
    ## exhaustive, even though each is problematic for only one of the zones.
    if (! isequal (datevec ("2017-03-12 02:15:00"), [2017  3 12 2 15 0]))
      printf ("bug #36954 occurs on 2017-03-12 02:15:00 with TZ=%s\n", zones{i});
    endif
    if (! isequal (datevec ("2017-03-26 02:15:00"), [2017  3 26 2 15 0]))
      printf ("bug #36954 occurs on 2017-03-26 02:15:00 with TZ=%s\n", zones{i});
    endif
    if (! isequal (datevec ("2017-08-13 00:15:00"), [2017  8 13 0 15 0]))
      printf ("bug #36954 occurs on 2017-03-13 00:15:00 with TZ=%s\n", zones{i});
    endif
    if (! isequal (datevec ("2017-10-01 02:15:00"), [2017 10  1 2 15 0]))
      printf ("bug #36954 occurs on 2017-10-01 02:15:00 with TZ=%s\n", zones{i});
    endif
    ## This tests a one-time loss of 30 minutes in Venezuela's local time
    if (! isequal (datevec ("2016-05-01 02:40:00"), [2016  5  1 2 40 0]))
      printf ("bug #36954 occurs on 2016-05-01 02:40:00 with TZ=%s\n", zones{i});
    endif
  endfor
unwind_protect_cleanup
  if (isempty (TZ_orig))
    unsetenv ("TZ");
  else
    setenv ("TZ", TZ_orig);
  endif
end_unwind_protect
