joke2k/faker — pull request #121 by mdxs (2014-07-02 08:33:46+00:00)
Title: Fixed date_time_ad method

Fixes #118 by using a `fromtimestamp(0) + timedelta(seconds=ts)` approach, rather than a direct `fromtimestamp(ts)` (which fails on some platforms). This solves the `ValueError: timestamp out of range for platform time_t` as seen on some platforms (like my 32-bit Xubuntu 14.04 virtual machine using Python 2.7.6).

See http://stackoverflow.com/a/10588133/2315612 for details. I've included a note with this reference saying *'using datetime.fromtimestamp(ts) directly will raise a "ValueError: timestamp out of range for platform time_t" on some platforms due to system C functions'* in-line. This is to help developers understand why this approach is needed and shouldn't be reverted.