I have confusion here (bcd >> 4)*10 = 0x09 * d10 = 0x90 or d144 does it calculate 0x90 * d10 or 0x90 * 0x0A? I think it calulates 0x90 * d10 because 10 is written as 10 and not 0x10 or 0x0A. Am I right?
I mean, use the pocket calculator to trace the operation of the rather straightforward bcd2dec() code.
I really don't understand where you expect to get "decimal 153". After some discussions, we all know the the RTC register content for year 99 is "1001 1001" binary or 0x99 or 153 decimal. Now you're converting it to decimal. We expect an output of 99 decimal, or 0x63, or "0110 0011" binary, isn't it?