Module: Stardate::STime

Defined in:
lib/stardate.rb

Instance Method Summary collapse

Instance Method Details

#to_stardateObject



9
10
11
12
13
14
15
# File 'lib/stardate.rb', line 9

def to_stardate
  t1 = self.beginning_of_year
  t2 = self.beginning_of_day
  days = (t2 - t1) / 3600 / 24 # days passed since the beginning of the year
  seconds = self - t2          # seconds passed since the beginning of the day
  ((self.year - YEAR_O) + days / YEAR_DURATION + seconds / (YEAR_DURATION * 24 * 3600)) * 1000
end