[MERGE] make local_time_offset() more reliable (bug 77588)
James Henstridge
james at jamesh.id.au
Tue Jan 2 08:41:29 GMT 2007
On 02/01/07, John Arbash Meinel <john at arbash-meinel.com> wrote:
> John Arbash Meinel has voted +1.
> Status is now: Semi-approved
> Comment:
> I could see adding a test that checks the returned value is an integer
> in the proper range (+-86400?, +-43200?)
>
> That should at least test our assumption about what this function
> returns.
Good idea. The possible range needs to extend to at least +13:00,
since that is the New Zealand DST time zone. There were a few
countries that went even further forward for the millennium
celebrations, so the +/-1 day interval is probably safer while making
sure the result is in the right ball park.
> I'm pretty sure it will always return a real integer, but we *might*
> want to wrap it in an int().
The datetime module works with integer quantities, so this shouldn't
be a problem (a separate microseconds count is kept in addition to
seconds).
Both fromtimestamp() and utcfromtimestamp() convert the argument to an
integer in the same way as the first step, so we shouldn't get any
problems from floating point arithmetic.
Attached is an updated bundle with the extra tests.
James.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: local-time-offset-fix.patch
Type: text/x-patch
Size: 4663 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070102/76ab2e90/attachment.bin
More information about the bazaar
mailing list