qbit wrote at 2020-2-24 05:18 -0800: >How about adding a time zone parameter to time.localtime? > >A offset just like the form: ± hh[:mm[:ss]].
Why should this be necessary? `localtime` returns the time in the "local timezone" -- and the "local timezone" usually does not change between different calls to `localtime`. Thus, it is best not to pass the timezone to each call to `localtime` but use environment information. If your "local timezone" does change frequently, you have (at least) the following options: * use `time.tzset` to reset the internal variables used by `localtime` from the envvar `TZ` (which your have appropriately set earlier) * use `time.time` (instead of `time.localtime`) and add the offset yourself. `time.time` returns the UTC time. -- Dieter -- https://mail.python.org/mailman/listinfo/python-list