# big_calendar

Universal gregorian calendar routines

Author | Oliver "Kiste" Seitz
Adapted-by |
Compiler | >=2.4o

Description

    The hardware RTCC present in some PIC devices is limited to years 2000...2099.
    If you want to build e.g. a time-travelling vehicle, such a clock is of little use.
    This software library implements a RTCC which is valid from friday, October 15, 1582
    to presumably at least the year 7000. Earlier, the julian calendar was valid. Later, the
    inaccuracy of the gregorian leap year rules may have accumulated to a whole day.

Dependencies

No dependency found

## Summary

### Global variables/contants

### Procedures

- `bigcal_update_current()`
- `bigcal_add_days(bigcal_datetype in out ddate, sword in distance)`
- `bigcal_find_easter(bigcal_datetype in out edate)`

### Functions

- `bigcal_days_per_month(word in year, byte in month) return byte`
- `bigcal_weekday(bigcal_datetype in ddate) return byte`

## API details

### Global variables/contants

### Procedures

- `bigcal_update_current()`

      Title:     Update current time and date
      Arguments: none
      Returns:   none
      Notes:     works on global variables current_date and current_time.
      "current_time.seconds" is to be updated somehow, e.g. a timer or the like.
      This procedure updates all the other variables, depending on the
      rising value of "current_time.seconds".
      It should be called regularly. Once a second is ok, but not stricktly
      necessary. "seconds" should not overflow, so this procedure must
      be called at least once every four minutes.

- `bigcal_add_days(bigcal_datetype in out ddate, sword in distance)`

      Title:     Alter a given date by a number of days
      Arguments: - Year
       Month
       Day
       distance
      Returns:   A modified date (year,month,day)
      Notes:     distance can be positive, moves date to the future
      distance can be negative, moves date to the past
      +/-32768 days is a bit more than 89 years

- `bigcal_find_easter(bigcal_datetype in out edate)`

      Title:     Find date of easter sunday
      Arguments: year in datetype record
      Returns:   complete datetype record with date of easter sunday
      Notes:     Calculates the date of easter sunday using formulae
      created by C.F. Gauss, modified by Dr. H. Lichtenberg
      as published by the german date and time authority
      "Physikalisch-Technische Bundesanstalt".

### Functions

- `bigcal_days_per_month(word in year, byte in month) return byte`

      Title:     Number of days per month
      Arguments: - Year (from 1582 up)
       Month (1 to 12)
      Returns:   Number of days in the specified month (28,29,30 or 31)
      Notes:     Respects leap years as defined by the gregorian calendar.

- `bigcal_weekday(bigcal_datetype in ddate) return byte`

      Title:     Weekday
      Arguments: - Year (from 1582 up)
       Month (1 to 12)
       Day (1 to 31)
      Returns:   Weekday of the given date (0=sunday, 1=monday...)
      Notes:     Based on "Zeller's congruence"

## Related samples

Here are the list of samples which use this library:

16f688 | 16f688_big_calendar.jal