Skip to content

Instantly share code, notes, and snippets.

@DouglasAllen
Created February 15, 2012 16:35
Show Gist options
  • Save DouglasAllen/1837159 to your computer and use it in GitHub Desktop.
Save DouglasAllen/1837159 to your computer and use it in GitHub Desktop.
A liitle ditty to play with Julian
#!/usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby
# a trick to block late entries.
require 'date'
time = Time.now.utc
theDate = Date.new(time.year, time.month, time.day)
=begin
=end # just put a blank space first and everything else is commented out.
puts time
puts theDate
puts theDate.ajd
puts theDate.jd - 0.5
puts theDate.jd
theDayFraction = time.hour/24.0 + time.min/1440.0 + time.sec/86400.0
puts theDayFraction
theTotal = theDate.ajd + theDayFraction
puts theTotal
@DouglasAllen
Copy link
Author

Expected output: Dates and times will vary.
Wed Feb 15 16:33:24 UTC 2012
2012-02-15
4911945/2
2455972.5
2455973
0.689861111111111
2455973.18986111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment