From ac87a7621c22563d8c8c2b9a1f92ee86cc7f15cf Mon Sep 17 00:00:00 2001
From: Marcus Comstedt <marcus@mc.pp.se>
Date: Mon, 19 Jan 1998 01:17:20 +0100
Subject: [PATCH] Julian calendar.

Rev: lib/modules/Calendar.pmod/Julian.pmod:1.1
---
 lib/modules/Calendar.pmod/Julian.pmod | 35 +++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 lib/modules/Calendar.pmod/Julian.pmod

diff --git a/lib/modules/Calendar.pmod/Julian.pmod b/lib/modules/Calendar.pmod/Julian.pmod
new file mode 100644
index 0000000000..7c03a20b85
--- /dev/null
+++ b/lib/modules/Calendar.pmod/Julian.pmod
@@ -0,0 +1,35 @@
+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);
+  }
+
+}
-- 
GitLab