Skip to content

Instantly share code, notes, and snippets.

@givanse
Created May 3, 2019 14:25
Show Gist options
  • Save givanse/ac5455b0ff60863b4e1fda2fc71ad355 to your computer and use it in GitHub Desktop.
Save givanse/ac5455b0ff60863b4e1fda2fc71ad355 to your computer and use it in GitHub Desktop.
time analysis
#!/usr/bin/python
# coding=utf-8
import time
import datetime
from math import pi
M1 = 8.6
M1short = 1.075
M1long = 2.15
M2 = 51.6 # six M1
genesis_datetime = '2009-01-03 19:15:05'
date_fmt = '%Y-%m-%d %H:%M:%S'
seconds_in_a_day = 60 * 60 * 24
cyclic_period_seconds = 1000 * pi * seconds_in_a_day
def date2epoch(date_str):
return time.mktime(datetime.datetime.strptime(date_str, date_fmt).timetuple())
def epoch2date(epoch_time):
return time.strftime(date_fmt, time.localtime(epoch_time))
genesis_timestamp = date2epoch(genesis_datetime)
print('Cyclic period (days): %s' % (cyclic_period_seconds / seconds_in_a_day))
print('Genesis: %s' % epoch2date(genesis_timestamp))
print('One cyclic period after genesis: %s' % epoch2date(genesis_timestamp + cyclic_period_seconds))
print('Two cyclic periods after genesis: %s' % epoch2date(genesis_timestamp + 2 * cyclic_period_seconds))
print("—-")
for i in range(0, 41):
frac = i / 4.0 # break down into quarter cycles
print("[%s + %s cycles]: %s" % (epoch2date(genesis_timestamp), frac, epoch2date(genesis_timestamp + frac * cyclic_period_seconds)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment