[Python-ideas] Reduce platform dependence of date and time related functions

M.-A. Lemburg mal at egenix.com
Wed Sep 18 09:42:18 CEST 2013


On 18.09.2013 03:37, Nick Coghlan wrote:
> On 18 September 2013 11:30,  <random832 at fastmail.us> wrote:
>> On Tue, Sep 17, 2013, at 17:15, Ethan Furman wrote:
>>> Is timegm/gmtime provided and consistent across all Python platforms?
>>
>> Part of what I was proposing was _to_ provide a consistent
>> implementation - there's no reason (if we define timestamps as being
>> objectively based in 1970 and having no leap seconds) that it couldn't
>> be provided in python itself instead of  using the system's version.
> 
> Yeah, this is a similar change to the one that was made for math.c
> years ago - stepping up from merely relying on the system libraries to
> ensuring a consistent cross-platform experience. It's just a concern
> with initial development and long term maintenance effort, rather than
> a fundamental desire to expose the raw platform behaviour (there are
> *some* modules where we want to let developers have access to the
> underlying platform specific behaviour, but the datetime APIs aren't
> really one of them)

I wonder why you'd want to use Unix ticks (what datetime calls a
timestamp) as basis for cross-platform date/time calculations.

If you really need a time_t representation of date/time values,
you're stuck with the platform dependent limitations anyway.

The time C functions are useful to tap into the OS's time zone
library, but time zone data changes regularly, so predictions that
go even only a few years into the future are bound to fail for some
zones. You can only reliably use UTC/GMT for absolute future date/time
values.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Sep 18 2013)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2013-09-11: Released eGenix PyRun 1.3.0 ...       http://egenix.com/go49
2013-09-20: PyCon UK 2013, Coventry, UK ...                 2 days to go
2013-09-28: PyDDF Sprint ...                               10 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-ideas mailing list