[PATCH] test_timestamp.py changes for win32
John Arbash Meinel
john at arbash-meinel.com
Thu Apr 19 01:41:12 BST 2007
Aaron Bentley wrote:
> Alexander Belchenko wrote:
>>>> This test is not checking negative dates. 1969-12-31 19:00:00 -0500 is
>>>> 1970-01-01 0:00:00 +0000, and we ought to be able to represent that on
>>>> all platforms. So win32 seems to be broken (admittedly on an edge case.)
>>>>> We shouldn't avoid the test on platforms where it succeeds. and
>>>>> "knownFailure" gives us a way to say "yeah, this doesn't work on this
>>>> I think KnownFailure is meant to reflect a bug in our code. A
>>>> KnownFailure should always fail. It is an error for such a test to
>>>> succeed when we expect it to fail.
>>>> Since it relates to platforms, UnavailableFeature seems more appropriate.
>> Here the patch with GmtimeNegativeSecondsFeature.
>> Can someone check this patch on Linux?
>> (python bzr --no-plugins selftest test_timestamp -v)
> Having looked at the implementation, I don't think that win32 is broken
> at all. I think the implementation is broken, but only win32 reveals
> the bug. Any timestamp on or after the epoch should not cause us to
> call gmtime with a negative value.
Well, I don't think we want to get into the act of manually generating
date strings from timestamps. Considering you have to deal with leap
years, leap seconds etc. So I don't think we want to figure out that
2000-02-29 21:00:00 -0500
2000-02-28 21:00:00 -0500
Also, I wonder if you offset formatting is correct.
Specifically there are timezones which are shifted by fractional hours.
(+10.5 in India, IIRC). We ran into other bugs with our timestamp
formatter related to these.
The standard way is: HHMM, which is (offset / 3600), ((offset / 60 )% 60)
You seem to be using seconds / 36 which gives 1150 as the TZ offset
instead of 1130. (11.50 hours versus 11hrs 30min).
So I think it is fine to be (ab)using time.gmtime() the way we are,
because it is really difficult to get it right otherwise. But I think
you need to change how you format offset.
On the other hand, I don't know if Patch dates use the standard ISO
format, but I would assume it does.
Makes it relatively clear that the TZ offset should be +HHMM. (Or +HH:MM
or +HH but not +HH.hh).
More information about the bazaar