i2c and a Dallas RTC Anyone??

So use (0x40 | your_time) for 24-hour, or ( ((is_am) ? 0 : 0x02) | your_time) for am/pm mode.

This is some really bad advice btw. I need to go back to bit shifting school.

24 hour mode: just use your_hour with no ORs (bit 6 - 0=24 hr, 1=12 hr)
12 hour mode: use -
0x40 | ((is_am) ? 0 : 0x20) | your_hour

your_hour should be binary-coded decimal (so 0x13 == 1pm in 24 hour mode).