summaryrefslogtreecommitdiff
path: root/lib/date2.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-23 08:37:35 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-23 08:37:35 +0000
commit688169fd83b24564b653c03977c168cea50ccd35 (patch)
treeb4724e5397cf5da5b554ab5795842a93145a88be /lib/date2.rb
parent5c13dd59db1ee6c04cdac4ce2ee97d5934115439 (diff)
2000-03-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/date2.rb')
-rw-r--r--lib/date2.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/date2.rb b/lib/date2.rb
index ef8bf83..706fec7 100644
--- a/lib/date2.rb
+++ b/lib/date2.rb
@@ -1,5 +1,5 @@
-# date2.rb: Written by Tadayoshi Funaba 1998, 1999
-# $Id: date2.rb,v 1.17 1999/09/15 05:34:07 tadf Exp $
+# date2.rb: Written by Tadayoshi Funaba 1998-2000
+# $Id: date2.rb,v 1.18 2000/03/20 16:23:32 tadf Exp $
class Date
@@ -110,6 +110,10 @@ class Date
def jd_to_mjd(jd) jd - 2400000.5 end
def tjd_to_jd(tjd) tjd + 2440000.5 end
def jd_to_tjd(jd) jd - 2440000.5 end
+ def tjd2_to_jd(cycle, tjd) tjd_to_jd(cycle * 10000 + tjd) end
+ def jd_to_tjd2(jd) clfloor(jd_to_tjd(jd), 10000) end
+ def ld_to_jd(ld) ld + 2299160 end
+ def jd_to_ld(jd) jd - 2299160 end
def julian_leap? (y) y % 4 == 0 end
def gregorian_leap? (y) y % 4 == 0 and y % 100 != 0 or y % 400 == 0 end
@@ -213,15 +217,18 @@ class Date
def rjd() @rjd end
def rmjd() Date.jd_to_mjd(@rjd) end
def rtjd() Date.jd_to_tjd(@rjd) end
+ def rtjd2() Date.jd_to_tjd2(@rjd) end
- once :rmjd, :rtjd
+ once :rmjd, :rtjd, :rtjd2
def jd() Date.rjd_to_jd(@rjd)[0] end
def fr1() Date.rjd_to_jd(@rjd)[1] end
def mjd() Date.jd_to_mjd(jd) end
def tjd() Date.jd_to_tjd(jd) end
+ def tjd2() Date.jd_to_tjd2(jd) end
+ def ld() Date.jd_to_ld(jd) end
- once :jd, :fr1, :mjd, :tjd
+ once :jd, :fr1, :mjd, :tjd, :tjd2, :ld
def civil() Date.jd_to_civil(jd, @sg) end
def ordinal() Date.jd_to_ordinal(jd, @sg) end