Branch: Tag:

2000-07-12

2000-07-12 19:36:16 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

first pike tree checkin

Rev: lib/modules/Calendar.pmod/Austrian.pmod:1.1
Rev: lib/modules/Calendar.pmod/CHANGES:1.1
Rev: lib/modules/Calendar.pmod/Calendar.pike:1.1
Rev: lib/modules/Calendar.pmod/Coptic.pmod:1.1
Rev: lib/modules/Calendar.pmod/Discordian.pmod:1.1
Rev: lib/modules/Calendar.pmod/Event.pmod:1.1
Rev: lib/modules/Calendar.pmod/Events.pmod:1.1
Rev: lib/modules/Calendar.pmod/FILES:1.1
Rev: lib/modules/Calendar.pmod/Gregorian.pmod:1.1
Rev: lib/modules/Calendar.pmod/ISO.pmod:1.1
Rev: lib/modules/Calendar.pmod/Islamic.pmod:1.1
Rev: lib/modules/Calendar.pmod/Julian.pmod:1.1
Rev: lib/modules/Calendar.pmod/Language.pmod:1.1
Rev: lib/modules/Calendar.pmod/Namedays.pmod:1.1
Rev: lib/modules/Calendar.pmod/Orthodox.pmod:1.1
Rev: lib/modules/Calendar.pmod/Roman.pmod:1.1
Rev: lib/modules/Calendar.pmod/Ruleset.pike:1.1
Rev: lib/modules/Calendar.pmod/Stardate.pmod:1.1
Rev: lib/modules/Calendar.pmod/Swedish.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZnames.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZrules.pmod:1.1
Rev: lib/modules/Calendar.pmod/TZs.h:1.1
Rev: lib/modules/Calendar.pmod/Time.pmod:1.1
Rev: lib/modules/Calendar.pmod/TimeRanges.pmod:1.1
Rev: lib/modules/Calendar.pmod/Timezone.pmod:1.1
Rev: lib/modules/Calendar.pmod/YMD.pmod:1.1
Rev: lib/modules/Calendar.pmod/localization.h:1.1
Rev: lib/modules/Calendar.pmod/mkrules.pike:1.1
Rev: lib/modules/Calendar.pmod/module.pmod:1.1
Rev: lib/modules/Calendar.pmod/namnsdagar:1.2(DEAD)
Rev: lib/modules/Calendar_I.pmod/Austrian.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Gregorian.pmod:1.23
Rev: lib/modules/Calendar_I.pmod/ISO.pmod:1.8
Rev: lib/modules/Calendar_I.pmod/Julian.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Orthodox.pmod:1.2
Rev: lib/modules/Calendar_I.pmod/Stardate.pmod:1.1
Rev: lib/modules/Calendar_I.pmod/Swedish.pmod:1.13
Rev: lib/modules/Calendar_I.pmod/module.pmod:1.5
Rev: lib/modules/Calendar_I.pmod/namnsdagar:1.2(DEAD)

1: - inherit Calendar.Gregorian; + //! + //! module Calendar + //! submodule Julian + //! inherits YMD + //! + //! This is the Julian calendar, conjured up by + //! the old Romans when their calendar were just too + //! wierd. It was used by the christians as so far + //! as the 18th century in some parts of the world. + //! (Especially the protestantic and orthodox parts.) + //! + //! note: + //! Don't confuse the <i>julian day</i> with the Julian + //! calendar. The former is just a linear numbering of days, + //! used in the Calendar module as a common unit for + //! absolute time.    - class Year - { -  inherit Calendar.Gregorian.Year; + import "."; + inherit Gregorian:Gregorian;    -  int julian_day(int d) // jd%7 gives weekday, mon=0, sun=6 + string calendar_name() { return "Julian"; } +  + static int year_leap_year(int y)   { -  return 1721424 + d + (36525*(y-1))/100; +  return !((y)%4);   }    -  int leap() + // [y,yjd] + static array year_from_julian_day(int jd)   { -  return !(y%4); -  } +  int d=jd-1721058;    -  +  int quad=d/1461; +  int quad_year=max( (d%1461-1)/365, 0); +  +  return +  ({ +  quad*4+quad_year, +  1721058+1461*quad+365*quad_year+!!quad_year +  });   }    - class Day + static int julian_day_from_year(int y)   { -  inherit Calendar.Gregorian.Day; -  -  void create(int ... arg) -  { -  if (!sizeof(arg)) -  { -  int jd = Calendar.Gregorian.Day()->julian_day()-1721424; -  y = jd*100/36525+1; -  d = jd-(y-1)*36525/100; +  y--; +  return 1721424+y*365+y/4;   } -  else -  ::create(@arg); -  } -  - } +