Inplementing calendar in 8 bit micro

May 22, 2008 26 Replies

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

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]: Try the download section. ** Posted from http://www.teranews.com **

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

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 This is intended to be my personal opinion which may, or may not be shared by my employer Atmel Nordic AB

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

Peter

Don't forget about the leap seconds...

Vladimir Vassilevsky DSP and Mixed Signal Design Consultant

formatting link

Why?

Robert

** Posted from
formatting link
**

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required