Advertisement
Kalidor_Vorlich

time

Sep 28th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.40 KB | None | 0 0
  1. import time
  2. import random
  3. import sys
  4. from os import system, name
  5.  
  6. def getTime():
  7.     #Earth Time
  8.     seconds = int(time.time()) #seconds since epoch(1200am, Jan 01 1970)
  9.  
  10.     #Game Time
  11.     gseconds = int(seconds * 25)
  12.     mincount = int (gseconds / 60)
  13.     hourcount = int(mincount / 60)
  14.     daycount = int (hourcount / 24)
  15.     monthcount = int (daycount / 30)  #simplified 30 day month
  16.     yearcount = int(monthcount /12)
  17.     weekcount = int (daycount / 8) #8 day week
  18.  
  19.  
  20.     ### -- CALC HOUR -- ###
  21.     hour = hourcount%(24)
  22.  
  23.     ### -- CALC MIN -- ###
  24.     minute = mincount%(60)
  25.  
  26.     ### -- CALC DAY -- ###
  27.     day = None
  28.     dayremainder = daycount%(8)
  29.     if dayremainder == 0:
  30.         day = "Firesday"
  31.     elif dayremainder == 1:
  32.         day = "Earthsday"
  33.     elif dayremainder == 2:
  34.         day = "Watersday"
  35.     elif dayremainder == 3:
  36.         day = "Windsday"
  37.     elif dayremainder == 4:
  38.         day = "Iceday"
  39.     elif dayremainder == 5:
  40.         day = "Lightningday"
  41.     elif dayremainder == 6:
  42.         day = "Lightsday"
  43.     elif dayremainder == 7:
  44.         day = "Darksday"
  45.     else:
  46.         print("DefaultDay")
  47.         print(dayremainder)
  48.  
  49.     ### -- CALC DATE -- ###
  50.     date = daycount%(30)
  51.  
  52.  
  53.     ### -- CALC MONTH -- ##
  54.     month = None
  55.     monthremainder = monthcount%(12)
  56.     if monthremainder == 0:
  57.         month = "January"
  58.     elif monthremainder == 1:
  59.         month = "February"
  60.     elif monthremainder == 2:
  61.         month = "March"
  62.     elif monthremainder == 3:
  63.         month = "April"
  64.     elif monthremainder == 4:
  65.         month = "May"
  66.     elif monthremainder == 5:
  67.         month = "June"
  68.     elif monthremainder == 6:
  69.         month = "July"
  70.     elif monthremainder == 7:
  71.         month = "August"
  72.     elif monthremainder == 8:
  73.         month = "September"
  74.     elif monthremainder == 9:
  75.         month = "October"
  76.     elif monthremainder == 10:
  77.         month = "November"
  78.     elif monthremainder == 11:
  79.         month = "December"
  80.     else:
  81.         print("DefaultMonth")
  82.         print(monthremainder)
  83.        
  84.     ### -- CALC SEASON -- ###
  85.     season = None
  86.     if month in ("November", "December", "January"):
  87.         season = "Winter"
  88.     elif month in ("February", "March", "April"):
  89.         season = "Spring"
  90.     elif month in ("May", "June", "July"):
  91.         season = "Summer"
  92.     elif month in ("August", "September", "October"):
  93.         season = "Autumn"
  94.     else:
  95.         print("DefaultSeason")
  96.         print(monthremainder)
  97.  
  98.  
  99.     ### -- CALC MOON
  100.     # new moon -> crescent moon -> half moon -> gibbous moon -> full moon
  101.     moon_day = daycount%(90)
  102.     moon_count = 0
  103.     if moon_day >=1 and  moon_day <= 7:
  104.         moon = 'new_moon'
  105.     elif moon_day >=8 and  moon_day <47:
  106.         moon = 'crescent_moon'
  107.     elif moon_day >=48 and  moon_day <= 64:
  108.         moon = 'half_moon'
  109.     elif moon_day >=65 and  moon_day <= 82:
  110.         moon = 'gibbous_moon'
  111.     elif moon_day >=83 and  moon_day <= 90:
  112.         if moon_day == 83:
  113.             moon_count = moon_count + 1
  114.            
  115.     #checking how many full moons have passed and if a prime number its a blood moon
  116.     if moon_count > 1:
  117.         # check for factors
  118.         for i in range(2,moon_count):
  119.             if (moon_count % i) == 0:
  120.                 print(moon_count,"is not a prime number")
  121.                 print(i,"times",moon_count//i,"is",moon_count)
  122.                 moon = 'Full Moon'
  123.             else:
  124.                 print(moon_count,"is a prime number")
  125.                 moon = 'Blood Moon'
  126.     else:
  127.         print(moon_count,"is not a prime number")
  128.         moon = 'Full Moon'
  129.                    
  130.  
  131.            
  132.  
  133.  
  134.  
  135.     ### -- SPECIAL DAYS -- ###
  136.     if date == 1 and month == 'January':
  137.         special_day = 'New Years Day'
  138.     elif date == 25 and month == 'March':
  139.         special_day = 'Spring Equinox'
  140.     elif date == 21 and month == 'June':
  141.         special_day = 'Summer Solstice'
  142.     elif date == 22 and month == 'September':
  143.         special_day = 'Autumn Equinox'
  144.     elif date == 30 and month == 'October':
  145.         special_day = 'Halloween'
  146.     elif date == 21 and month == 'December':
  147.         special_day = 'Winter Solstice'
  148.     elif date == 25 and month == 'December':
  149.         special_day = 'Xmas'
  150.     else:
  151.         special_day = None
  152.  
  153.  
  154.         ### -- BONUS DAYS -- ###
  155.     if day == 'Firesday':
  156.         print("Firesday Bonus!")
  157.     elif day == 'Earthsday':
  158.         print("Earthsday Bonus!")
  159.     elif day == 'Watersday':
  160.         print("Watersday Bonus!")
  161.     elif day == 'Windsday':
  162.         print("Windsday Bonus!")
  163.     elif day == 'Iceday':
  164.         print("Iceday Bonus!")
  165.     elif day == 'Lightningday':
  166.         print("Lightningday Bonus!")
  167.     elif day == 'Lightsday':
  168.         print("Lightsday Bonus!")
  169.     elif day == 'Darksday':
  170.         print("Darksday Bonus!")
  171.     else:
  172.         print("No Bonus...")
  173.  
  174.        
  175.  
  176.  
  177.     def time_now():
  178.         print("Seconds Since Epoch - ", seconds)
  179.         print(day, " - ",date, " - " ,month, " - ", yearcount, " in the ", season, " time.", " It's: ",hour, ":",minute)
  180.         print("Moon = ",moon)
  181.         print("Special day - ",special_day)
  182.         time.sleep(1/25)
  183.         # for windows
  184.         if name == 'nt':
  185.             _ = system('cls')
  186.        
  187.         # for mac and linux(here, os.name is 'posix')
  188.         else:
  189.             _ = system('clear')
  190.  
  191.     time_now()
  192.  
  193.  
  194.  
  195. while True:
  196.     getTime()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement