Change Log

mxDateTime Change Log

The change log includes a detailed description of all changes to this package in the recent releases.
Version: 3.2.1

Changes from 3.2.0 to 3.2.1

  • Fixed a segfault when comparing DateTime/DateTimeDelta with None objects. Thanks to Mark Matthews for reporting this.

Changes from 3.1.2 to 3.2.0

  • Added new .rebuild() methods to both DateTime and DateTimeDelta objects, making it easier creating new objects from existing ones by just replacing some of the parameters (akin to the mxURL .rebuild() method).
  • Greatly enhanced the interoperability with the Python datetime module objects:
    • Added support for handling mixed type operations with datetime.time objects.
    • Added new constructor methods to DateTime and DateTimeDelta objects which aid in combining them with Python datetime module objects: .pytime(), .pytimedelta(), .pydatetime() and .pydate() as appropriate.
    • Added support for Python datetime module objects to the generic mxDateTime constructors DateTimeFrom(), DateFrom(), DateTimeDeltaFrom() (and their aliases).
    • The Python datetime module's C API is now loaded on demand whenever mxDateTime needs to work with PyDateTime objects.
    • mxDateTime was updated to use mixed type number slots, a feature which was added to Python in version 2.1 (by the author of mxDateTime, Marc-AndrĂ© Lemburg). This has made working with DateTime and DateTimeDelta objects and other date/time types a lot more orbust.
  • mxDateTime's gmtime() now also works for ticks values beyond 2038 on 32-bit platforms that implement a POSIX confirm gmtime(), but cannot handle post 2038 dates due to data type restrictions, e.g. older 32-bit Linux platforms. As side-effect, this also speeds up the gmtime() implementation on all platforms with POSIX conform date/time handling.
  • mxDateTime will try to use the most accurate clock available on the system for now(). For most POSIX systems, this is a nanosecond resolution clock. A new global now_resolution allows checking the resolution reported by the system. The performance of now() was enhanced by directly interfacing to the various platform C APIs.
  • Changed: mxDateTime will now format the seconds value in the repr() and the str() output rounded to two decimal places. In previous versions, it used to truncate the fraction after two decimal places.
  • Known problem: mxDateTime doesn't build on FreeBSD with Python 2.7 and 2.7.1. This is a known problem with Python 2.7 and will be fixed in Python 2.7.2. See for details.
  • DateTimeFrom() now accepts a defaultdate parameter when parsing strings or keyword-only arguments. defaultdate provides the defaults to assume when pars of the date/time are not given. It defaults to today().
  • DateFrom() will now only parse the date parts of a string and only accept date-related keyword arguments.
  • Fixed a bug in the mxDateTime parser that triggered with some ISO formats using second fractions. Thanks to Francesco Pierfederici for bringing this to our attention.
  • Added support for more US AM/PM date formats such as "5:08pm" (without space), "5:08 p.m." (with additional dots) to the mxDateTime parser. Thanks to Tom at TicketStumbler for bringing this to our attention.
  • Changed C API: mxDateTime now uses C longs for years internally and in the C API. Note that the published C API has changed because of this: mxDateTime.DateTime_FromDateAndTime() now expects a long as year instead of an int. This change will require a recompile of the applications using the mxDateTime C API, but should only be noticeable on 64-bit platforms.
  • Added new C API DateTime_FromAbsDateTime to the mxDateTime C API.
  • Added version number to C API object: Due to the changes in the C API, the name of the C API object "mxDateTimeAPI" was changed to "mxDateTimeAPI2", so that applications relying on the old API don't import the changed API by accident.
  • Added optional calendar parameter to DateTimeFromAbsDateTime(). This allows creating DateTime instances with a given calendar. Default is to use the Gregorian calendar.
  • Added BST to mx.DateTime.Timezone.
  • Fixed problem with now() resolution on Windows. It now provides millisecond resolution again.
  • Fixed a bug in mx.DateTime.DateTimeFromAbsDateTime() which caused an endless loop on 64-bit platforms for very large year values.
  • Fixed Debian bug#494792: Incorrect subtraction with regular Python datetime. This was actually a side-effect of the coercion logic previously used in mxDateTime and not really a bug. The new mixed type number slot implementations made it possible to correctly handle the argument positions.
  • Fixed a possible ZeroDivision error in mx.DateTime.NIST(). Thanks to Darko Zurman for pointing this out.
    Removed left-over debug code which caused the builtin strptime() never to get used. Thanks to Alok Singhal for this one.
  • Fixed a bug in the mxDateTime .ticks() method which causes it to raise an error for values that point to one second before the Epoch.

Changes from 3.1.0 to 3.1.2

  • Fixed: mxDateTime now also provides a strptime() function on Windows.

Changes from 3.0.0 to 3.1.0

  • Fixed: Negative day values were not normalized correctly. Thanks to Eugene Chow.

Changes from 2.0.3 to 3.0.0

  • Changed: Made Error a subclass of ValueError instead of Python's StandardError.

  • Enhanced the (still undocumented) Locale module a bit to provide more flexible date/time presentations. Made the the default formats a little nicer.

  • Added better range error reporting.

  • Changed: the way seconds are display in DateTime string representations. Previously, the seconds value was truncated to 2 decimal places, now the seconds value is rounded except for values >=59.995 and <60.00. These are all mapped to 59.99. This strategy enhances accuracy when exchanging DateTime string data with other data sources or storages e.g. databases.

  • Clarified the doc-strings: most C APIs do not accept keyword arguments (might change in a future release, though).

  • Added updated example; J.J. Dukarm send me a corrected copy which now deals correctly with centuries (rather than milleniums ;-).

  • Added support for RelativeDateTime hashing and equality comparison tests.

  • Added new 'usiso' style date parser for YYYY/MM/DD.

  • Fixed a bug which only shows up in Python debug builds: _Py_ForgetReference() was not used correctly by the free list implementations.

  • Added new 'X days HH:MM' style date/time delta parsing support (needed for PostgreSQL).

  • Changed the way 86400.0 is mapped to broken down time values. Previously, this used to map to 24:00:00, now this returns 23:59:60 and can be used to represent leap seconds.

  • Added a work-around for the Intel platform quirk where C doubles are truncated in precision when passed from the FPU (80 bits) to the stack (64 bits). This caused glitches like e.g. date/time arithmetic to generate output like 24:00:00 which is reserved for leap seconds.

  • Fixed a bug in the AM/PM parsing of Thanks to Dmitri D. Sayakin.

  • Added attributes __roles__ and __allow_access_to_unprotected_subobjects__ to DateTime, DateTimeDelta and RelativeDateTime objects to enable using these in Zope Page Templates.

  • Fixed a bug in hash algorithm for RelativeDateTime instances. The hash value for None is now hardcoded.

  • Added source code encoding markers to those files that need it.

  • Fixed bugglet in parser which caused the day to sometimes come out as string in _parse_date().

  • strptime() error messages now include the faulty string.

  • Parser.TimeFromString() is now a real parser in its own right (it was previously aliased to DateTimeDeltaFromString). This also caused a bug to be fixed: the AM/PM parsing was (and still is) missing from the DateTimeDeltaFromString parser.

  • Relative time formats now also support the comma as decimal point (this is required by the ISO standard).

  • Changed: .tuple() used to return floats for the seconds value. This has been changed to integers to avoid a DeprecationWarning when using the tuple with time module APIs (they expect an integer for seconds).

  • Changed: type names now include the complete Python module path, i.e. mx.DateTime.DateTime and mx.DateTime.DateTimeDelta.

  • Added some more fixes to work around warnings with floats being passed to integer argument parsers.

  • Made some integer division cases more robust to prepare for Python3.

  • DateTimeFromTicks() will now raise an Error in case the underlying localtime() C API returns an error.

  • Added support to parse non-standards conform ISO dates such as 2003-1-1.

  • Changed: the DateTimeFrom() et al. APIs to pass on keywords to the underlying mx.DateTime.Parser APIs. This allows e.g. restricting formats to be parsed.

  • Relaxed time parsing in Parser.DateTimeFromString() by adding a separate time_formats parameter which defaults to a standard set of parser, including 'unknown'.

  • Added preliminary Unicode support to string parser. This will work by virtue of auto-conversion.

  • Added work-around for the .strftime() method so that it will correctly output the timezone even if the underlying C function doesn't determine the day light saving time by itself when invoked with -1 in this field (reported by Shawn Dyer).

  • Changed: Normalized the time part of the RelativeDateTime() string representation, so that fractional hours and minutes values are shown as minutes and seconds. Seconds are still truncated to integers.

Changes from 2.0.2 to 2.0.3:

  • Made the date/time parser case-insensitive and extended it to also parse many Eurpean literal date/time formats, such as 'Sonntag, der 6. November 1994, 08:49:37 GMT'

  • Fixed a bug in TimeFromTicks(); thanks to Alex Martelli for finding this one.

  • Added a new example by J.J. Dukarm to the Examples directory which demonstrates writing date/time parsers using different more strict conventions. Thanks to JJD for this one !

  • Fixed the Max/MinDateTime constant and the range checks in mxDateTime.c to 32-bit values. This allows mxDateTime to compile correctly on 64-bit platforms. Thanks to Trond Glomsrod for pointing this out.

  • Made the date/time parser even more flexible and added support for partial date formats ('month/day', 'litmonth day', 'day.month.') as well as mixes of different formats. Another new supported format is 'MM-DD-YYYY' (note that the four year digits are important to distinguish this format from ISO).

  • Added 'AM/PM' support to the Parser module.

  • Made the C extension extra careful about float rounding bugs, so that dates like 2001-01-01 24:00:00 don't happen anymore. Chuck Esterbrook mentioned that 2.0.2 still had problems on Mandrake (sigh) with e.g. DateTime(2000,12,31)+1.

  • Fixed the REs in DateTime.Parser to work with sre from Python 2.2 (group names have to be unique).

Changes from 2.0.0 to 2.0.2:

  • Fixed two typos in the Locale submodule. Thanks to Raul Garcia Garcia for spotting these.

  • Fixed a bug in the coercion code which surfaced due to the rich comparison changes in Python 2.1. Python 2.1 will now compare DateTime[Delta] objects to other objects without raising a TypeError.