Branch: Tag:

1998-01-19

1998-01-19 00:17:20 by Marcus Comstedt <marcus@mc.pp.se>

Julian calendar.

Rev: lib/modules/Calendar.pmod/Julian.pmod:1.1

1: + inherit Calendar.Gregorian;    -  + class Year + { +  inherit Calendar.Gregorian.Year; +  +  int julian_day(int d) // jd%7 gives weekday, mon=0, sun=6 +  { +  return 1721424 + d + (36525*(y-1))/100; +  } +  +  int leap() +  { +  return !(y%4); +  } +  + } +  + class Day + { +  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; +  } +  else +  ::create(@arg); +  } +  + }   Newline at end of file added.