Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

darian_calendar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

darian_calendar

  • 1.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Darian Calendar

Gem Version Build Status

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 #=> '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_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

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:

# From anywhere in the project directory:
bundle exec rspec
  • 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.

FAQs

Package last updated on 24 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc