Skip to content

Instantly share code, notes, and snippets.

@samuelcouch
Created October 30, 2012 08:49
Show Gist options
  • Save samuelcouch/3979074 to your computer and use it in GitHub Desktop.
Save samuelcouch/3979074 to your computer and use it in GitHub Desktop.
Curiosity & Opportunity Mission Sol Count
#Ruby code ported by Sam Couch, original inspiration -> https://github.com/jtauber/mars-clock
millis = (Time.now.to_f)*1000
jd_ut = (2440587.5 + (( millis ) / ((8.64)*(10**7))))
jd_tt = (jd_ut + (35 + 32.184) / 86400)
j2000 = jd_tt - 2451545.0
msd = (((j2000 - 4.5) / 1.027491252) + 44796.0 - 0.00096)
mtc = ((24 * msd) % 24)
curiosity_lambda = 360 - 137.4
curiosity_sol = (((msd - curiosity_lambda / 360).floor) - 49268)
opportunity_sol = (msd - 46235 - 0.042431).floor
puts "curiosity_sol: #{curiosity_sol}"
puts "opportunity_sol: #{opportunity_sol}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment