The type of the result of (24 * 3600) is int. On PalmOS this is 16bits in
size. The result can not fit in 16bits so the high-order bits are truncated
leaving you with the lower 16bits which are 0x5180 == 20864decimal.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Danko Radic
Sent: Friday, February 25, 2000 3:52 AM
To: Palm Developer Forum
Subject: Little C or compiler question
(CW R5 + 2 patches, Win95)
I have:
ULong T1,T2,NumOfDays;
Why does:
NumOfDays=(T2-T1)/86400+1;
give correct result and
NumOfDays=(T2-T1)/(24*3600)+1;
doesn't?
T1, T2 are times in seconds, and when they differ for 1.999 days, 1st
operation gives correct NumOfDays=2, but 2nd gives result NumOfDays=9.
If it is automatic casting problem, where can I find these rules?
Rgds,
-DR
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html