localtime should accept any positive time value. Take 3

Dmitry Timoshkov dmitry at codeweavers.com
Sat Feb 11 09:59:37 CST 2006


On Sat, 2006-02-11 at 11:58 +0100, Rein Klazes wrote:

> >-  ULONGLONG time = *secs * (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
> >+  /* time < 0 means a date before midnight of January 1, 1970 */
> >+  if (*secs < 0) return NULL;
> 
> I think the comment is incorrect: it should be *secs < 0;

I intentionally left it to say "time" since it is "time".

> If *secs < 3600, in time zones on the western hemisphere it is still
> 1969.

Thanks for the hint. Attached simple test app prints the same results
under XP SP2 and Wine with my patch in my current time zone, which
confirms it:

Wed Dec 31 18:00:00 1969
Wed Dec 31 19:00:00 1969
Wed Dec 31 20:00:00 1969
Wed Dec 31 21:00:00 1969
Wed Dec 31 22:00:00 1969
Wed Dec 31 23:00:00 1969
Thu Jan 01 00:00:00 1970
Thu Jan 01 01:00:00 1970

So, I just removed (confusing) FIXME. Here is an updated patch.

Changelog:
    localtime should accept any positive time value.

-- 
Dmitry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: localtime.diff
Type: text/x-patch
Size: 1294 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060211/057d7c97/localtime.diff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: localtime.c
Type: text/x-csrc
Size: 222 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060211/057d7c97/localtime.c


More information about the wine-patches mailing list