Darian Calendar
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.
Installation
In Bundler:
gem "darian_calendar"
Otherwise:
[sudo|rvm] gem install darian_calendar
Usage
require 'darian_calendar'
mars_time = DarianCalendar.now
mars_time = DarianCalendar.now(DarianCalendar::CalendarTypes::DEFROST)
mars_time = DarianCalendar::Time.now
mars_time = DarianCalendar::Time.now(DarianCalendar::CalendarTypes::AREOSYNCHRONOUS)
mars_time = DarianCalendar::Time.from_earth(Time.utc(2012, 10, 15, 16, 50, 0))
mars_time = DarianCalendar::Time.from_earth(Time.utc(2012, 10, 15, 16, 50, 0), DarianCalendar::CalendarTypes::AQUA)
mars_time = DarianCalendar::Time.parse_earth('2012-10-15 16:50:00 UTC')
mars_time = DarianCalendar::Time.parse_earth('2012-10-15 16:50:00 UTC', DarianCalendar::CalendarTypes::MARTIANA)
mars_date = DarianCalendar::Date.today
mars_date = DarianCalendar::Time.now.to_date
mars_time.to_s
mars_time.year
mars_time.month
mars_time.sol
mars_time.hour
mars_time.min
mars_time.sec
mars_time.total_sols
mars_time.season
mars_time.sol_of_season
mars_time.month_of_season
mars_time.sol_of_year
mars_time.week_sol
mars_time.month_name
mars_time.week_sol_name
mars_time = DarianCalendar::Time.from_earth(Time.utc(2012, 10, 15, 16, 50, 0))
mars_time.to_earth
DarianCalendar::CalendarTypes::MARTIANA
DarianCalendar::CalendarTypes::DEFROST
DarianCalendar::CalendarTypes::AREOSYNCHRONOUS
DarianCalendar::CalendarTypes::HENSEL
DarianCalendar::CalendarTypes::AQUA
Supported Ruby Interpreters
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
Testing
Unit tests are provided for all of Darian Calendar's methods:
bundle exec rspec
Copyright
- The Darian Calendar Ruby Gem is Copyright © 2014 by Christian Worreschk, MarSec.
- The Darian System is Copyright © 1986-2005 by Thomas Gangale
License
This Darian Calendar Ruby Gem is released under the European Union Public Licence V. 1.1.