[issue24517] %z does not work in time.strftime()
New submission from dendory: Using `%z` gives the same result as using `%Z` in `time.strftime()`: Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.strftime("%z") 'Eastern Daylight Time' >>> time.strftime("%Z") 'Eastern Daylight Time' Instead it's supposed to give a + or - result. -- messages: 245860 nosy: dendory priority: normal severity: normal status: open title: %z does not work in time.strftime() versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue24517> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24517] %z does not work in time.strftime()
dendory added the comment: Uh? But that's completely besides the point. Windows provides timezone offset information in a different way than Linux does (through the Registry) but it's still available. It's trivial to do in .NET for example: Console.WriteLine(TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)); Aren't a lot of things implemented differently in Linux and Windows? I'm not familiar with Python's internals, but I'm sure a lot of functions are implemented differently cross platform. This bug is certainly valid, as any code using this function will not work as expected on this platform. -- ___ Python tracker <http://bugs.python.org/issue24517> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20281] time.strftime %z format specifier is the same as %Z
dendory added the comment: Why is the focus on documentation entries when the real work should be on trying to make this function to work on all platforms? I understand that Windows's implementation of strftime() defines %z and %Z to return the same thing, but timezone information is still available in other ways. For example, _get_timezone() returns the offset in seconds between localtime and UTC. I don't have VC++ 2010 installed so I can't test it but this seems like a fairly simple thing to fix. Just take that result and multiply. ref: https://msdn.microsoft.com/en-us/library/38wx0s70%28v=vs.100%29.aspx ------ nosy: +dendory ___ Python tracker <http://bugs.python.org/issue20281> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com