The Darian calendar is a proposed system of time-keeping designed to serve the needs of any possible future human settlers on the planet Mars. It was created by aerospace engineer and political scientist Thomas Gangale in 1985 and named by him after his son Darius. (Wikipedia)
This Ruby library converts earth time to mars time and back again. You can choose between 5 variants of the Darian calendar system; Martiana, Defrost, Areosynchronous, Hensel and Aqua.
It's based on the JavaScript Converter which was developed by Alan Hensel and Thomas Gangale.
In Bundler:
gem "darian_calendar"
Otherwise:
[sudo|rvm] gem install darian_calendar
require 'darian_calendar'
mars_date = DarianCalendar.today
mars_date = DarianCalendar::Date.today
mars_date = DarianCalendar::Time.now.to_date
mars_date = DarianCalendar::Date.by_digits(214, 14, 26)
mars_date = DarianCalendar::Date.parse_earth('2012-10-15')
mars_date = DarianCalendar::Date.from_earth(Date.new(2012, 10, 15))
mars_time = DarianCalendar.now
mars_time = DarianCalendar::Time.now
mars_time = DarianCalendar::Time.by_digits(214, 14, 26, 20, 12, 2)
mars_time = DarianCalendar::Time.parse_earth('2012-10-15 16:50:00 UTC')
mars_time = DarianCalendar::Time.from_earth(Time.utc(2012, 10, 15, 16, 50, 0))
mars_time.to_s #=> '214-14-26 20:10:02'
mars_time.year #=> 214
mars_time.month #=> 14
mars_time.sol #=> 26
mars_time.hour #=> 20
mars_time.min #=> 10
mars_time.sec #=> 2
mars_time.total_sols #=> 143466.84030197054
mars_time.season #=> 2
mars_time.sol_of_season #=> 53
mars_time.month_of_season #=> 1
mars_time.sol_of_year #=> 387
mars_time.week_sol #=> 5
mars_time.month_name #=> 'Sol Jovis'
mars_time.week_sol_name #=> 'Mithuna'
mars_date = DarianCalendar::Date.by_digits(2012, 10, 15)
mars_date.to_earth #=> 2012-10-15
mars_time = DarianCalendar::Time.from_earth(Time.utc(2012, 10, 15, 16, 50, 0))
mars_time.to_earth #=> 2012-10-15 16:50:00 UTC
DarianCalendar::CalendarTypes::MARTIANA #=> Default
DarianCalendar::CalendarTypes::DEFROST
DarianCalendar::CalendarTypes::AREOSYNCHRONOUS
DarianCalendar::CalendarTypes::HENSEL
DarianCalendar::CalendarTypes::AQUA
# How to use
mars_date = DarianCalendar::Date.by_digits(214, 14, 26, DarianCalendar::CalendarTypes::AREOSYNCHRONOUS)
mars_time = DarianCalendar.now(DarianCalendar::CalendarTypes::DEFROST)
This library aims to support and is tested against the following Ruby interpreters and versions:
- MRI 1.9.2
- MRI 1.9.3
- MRI 2.0.0
- MRI 2.1.0
- JRuby
- Rubinius
Unit tests are provided for all of Darian Calendar's methods:
# From anywhere in the project directory:
bundle exec rspec
- The Darian Calendar Ruby Gem is Copyright © 2014 by Christian Worreschk.
- The Darian System is Copyright © 1986-2005 by Thomas Gangale
This Darian Calendar Ruby Gem is released under the MIT Licence.