TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: all
from: Timothy J. Martin 71541,3611
date: 1994-02-21 11:34:25
subject: OSK mktime bug, cc V3.2

#: 19743 S12/OS9/68000 (OSK)
    21-Feb-94  11:34:25
Sb: OSK mktime bug, cc V3.2
Fm: Timothy J. Martin 71541,3611
To: all

The Microware OS-9 resident C compiler V3.2 libraries and cio trap handler have
a bug in the mktime function.

The mktime function does not properly compute the value of the tm_yday element
in the tm stucture.  In specific, for days after January 31st, the values are
too small by a value of 31.

Microware is aware of the bug and says that the fix is to get the Ultra C
package.  For those who don't like this solution, the bug is easily fixed with
a one byte replacement patch, in the libraries and cio.  A bgt branch needs to
be changed to a bge branch.  The bug is likely widely known, and may have been
fixed elsewhere if not:

in clib.l and clibn.l, at offset $BB1 change $6e to $6c.

in clib020.l, clib020n.l, and clib020h.l at offset $e29 change $6e to $6c.

in cio at offset $a0e change $6e to $6c.

in cio020 at offset $a04 change $6e to $6c.

Remember to perform fixmod -u on the cio and cio020 files after the patch is
done. This patch assumes cio and cio020 module edition #6.

When a patch is suggested by a miscellaneous individual like myself, it is done
at your own risk.  Be careful with the cio patch in particular. The operating
system won't get very far with a bad cio module.

******* Do the fixmod -u after the patch on cio and/or cio020. ********

Make sure that the byte you are replacing in all instances is a $6e.

****************************************************************************

If you don't want to be patching your libraries and trap handler, then a fix in
a C program, after mktime is called might read:

        if(tp.tm_mon > 0) tp.tm_yday += 31;

****************************************************************************

21-FEB-94 tjmartin@anl.gov CIS 71541,3611

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.