[Icc-avr] RTC - how to compute the difference in minutes

Paul Mateer paul.aa9gg at gmail.com
Thu Nov 15 06:26:32 PST 2007


Maybe if you convert the date to Julian Days that would help.  If
possible maybe the RTC could trigger an interrupt to so you could
count days since event#1.  I built a "TAB" timer not to long ago, but
did the date compare as yy.mm.dd

	 TEST_RTC_TIME = (fix_hr * 100) + fix_min;
	 TEST_RTC_DATE = ((unsigned long)fix_rtc_yr * 10000)+((unsigned
long)fix_rtc_month *100)+(unsigned long)fix_rtc_date;


On Nov 14, 2007 11:42 PM, Robert Rademacher <robertrade at yahoo.com> wrote:
> Hi all,
>
> I'm wondering if anyone has done the difftime routine for ICCAVR that would
> compute the difference in minutes, using PCF8563 RTC. I know ICCAVR does not
> have time.h library.
>
> Here is the elapsed minutes calculation:
>
> To compute for elapsed minutes (format: dd.mm.yy  hh.mm)
>
> Start date-time: 14.11.2007 10.15
> Final date-time 15.11.2007 8.15
>
> Calculated for elapsed time: 22 hours or 1,320 minutes.
>
> This may look easy, but remember, we are dealing with leap year, specific
> number of days/month, etc that need to be factored in when calculating the
> difference between the start and end time-date stamps. It would be nice if
> there is a RTC IC that has the mktime/gmtime I can read off instead of
> individual numbers from date/time sections.
>
> I search everywhere for the code snippet designed for AVR and did not find
> what I'm looking for as described above.
>
> Any good suggestions, as I'm bit pressed for deadline. I am sure everyone
> may be interested in this potential solution.
>
> Robert
>
>
>  ________________________________
> Get easy, one-click access to your favorites. Make Yahoo! your homepage.
> _______________________________________________
> Icc-avr mailing list
> Icc-avr at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-avr
>
>



-- 
Paul Mateer, AA9GG
Elan Engineering Corp.
www.elanengr.com



More information about the Icc-avr mailing list