TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Chris Mcbrien
from: David Noon
date: 1994-07-28 20:22:04
subject: Compiler Bug

On Monday, 1994-07-25  Chris Mcbrien wrote to All about "Compiler Bug"
as follows:

CM> I am using C/Set++ version 2.1 for OS/2.
CM> 
CM> I have been writing a small utility for OS/2 BBS's, when I 
CM> discovered a bug in the compiler.
CM> 
CM> When calling the standard C function LocalTime, I have 
CM> noticed that the structure field StuctName->tm_mon contains 
CM> a value one less than the correct month.
CM> 
CM> Has anybody else seen this?  Am I lossing my marbles?  I 
CM> have confirmed this with a minimal test program, and the 
CM> IPMD.

Hi Chris,

I clipped the following from the C Set ++ library .INF file:

___--------------------------------------------------------- 

 The fields of the tm structure include: 

 Field            Value Stored 
 tm_sec           Seconds (0-61) 
 tm_min           Minutes (0-59) 
 tm_hour          Hours (0-23) 
 tm_mday          Day of month (1-31) 
 tm_mon           Month (0-11;  January = 0) 
 tm_year          Year (current year minus 1900) 
 tm_wday          Day of week (0-6;  Sunday = 0) 
 tm_yday          Day of year (0-365;  January 1 = 0) 
 tm_isdst         Zero if Daylight Saving Time is not in effect;  positive
if Daylight 
                  Saving Time is in effect;  negative if the information is
not available. 
___----------------------------------------------------

So the months of the year are numbered 0-11, not 1-12. This explains
why it seems to be a month earlier than the calendar says. If you use
the asctime() function to convert to ASCII it will convert it
correctly.

Regards

Dave

___
 X KWQ/2 1.2e X I have so much mail, I've sinking in .QWKsand...

--- Maximus/2 2.01wb

* Origin: OS/2 Shareware BBS, Fairfax, VA: 703-385-4325 (1:109/347)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 413 430
SEEN-BY: 711/807 808 809 934 942 712/353 623 713/888 800/1
@PATH: 109/347 2 1 3615/50 229/2 12/2442 711/409 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.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™.