Inplementing calendar in 8 bit micro

Just a side note: You might want to give TargetLink a try.

Reply to
Hans-Bernhard Bröker
Loading thread data ...

Well, you are also calculating leap, and allowing for the 100 year mark, and you have month scaled from 1 rather than 0. So the comparision is not quite fair. It also requires generating object code for various machines :-) However I suspect that mine will be more understandable. :-)

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
 Click to see the full signature
Reply to
CBFalconer

This will work for quite longer period:

u8 leap_year(u16 year) { u16 utmp; u8 leap = 0;

if(!(year & 0x03)) { utmp = (u16)((((u32)year)*41943)>>16); utmp++;

if(!(utmp&0x3E)) { if(!(utmp&0xC0)) leap = 1; else leap = 0; } else leap = 1; }

return leap; }

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

skrev i meddelandet news: snipped-for-privacy@34g2000hsh.googlegroups.com...

Don't forget that the clock changes by one hour twice a year for summertime...

--
Best Regards,
Ulf Samuelsson
 Click to see the full signature
Reply to
Ulf Samuelsson

And that for the southern hemisphere summer straddles the year-end.

Peter

Reply to
Peter Dickerson

Don't forget about the leap seconds...

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

Why?

Robert

** Posted from
formatting link
**
Reply to
Robert Adsett

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.