piclist 2002\10\06\125944a >
Thread: BCD time-of-day addition
www.piclist.com/techref/microchip/time.htm?key=time
flavicon
face BY : Wagner Lipnharski email (remove spam text)



Spehro Pefhany wrote:
> Doing the addition is simple- just add the minutes first, adjust it
> modulo 60 and add any carry to the hours, add on the delta and adjust
> it modulo 24, with any resulting carry from that operation
> representing a time in the next day. Here's some (untested) C code
> that represents what should be done:
>
>    c= 0; d=0;
>    min += m; if (min >= 60) {min -= 60; c++;};


min = 59h
m   =  2h

min + m = 5Bh

[snip]

/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Wagner Lipnharski - UST Research Inc
Orlando FLorida - USA - http://www.ustr.net
/_/_/_/ Atmel AVR Consultant /_/_/_/

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


<00a101c26d59$7fa79040$9acc1b18@cfl.rr.com> 7bit

See also: www.piclist.com/techref/microchip/time.htm?key=time
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) BCD time-of-day addition

month overview.

new search...