Skip to content

Commit

Permalink
Merge pull request #1905 from Neradoc/patch-1
Browse files Browse the repository at this point in the history
Matrix Portal Moon Clock fix for Circuitpython 7
  • Loading branch information
PaintYourDragon authored Nov 3, 2021
2 parents 58e230b + ffc68ee commit a544133
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Matrix_Portal_Moon_Clock/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ def parse_time(timestring, is_dst=-1):
date_time = timestring.split('T') # Separate into date and time
year_month_day = date_time[0].split('-') # Separate time into Y/M/D
hour_minute_second = date_time[1].split('+')[0].split('-')[0].split(':')
return time.struct_time(int(year_month_day[0]),
return time.struct_time((int(year_month_day[0]),
int(year_month_day[1]),
int(year_month_day[2]),
int(hour_minute_second[0]),
int(hour_minute_second[1]),
int(hour_minute_second[2].split('.')[0]),
-1, -1, is_dst)
-1, -1, is_dst))


def update_time(timezone=None):
Expand Down Expand Up @@ -126,14 +126,14 @@ def __init__(self, datetime, hours_ahead, utc_offset):
# Can't change attribute in datetime struct, need to create
# a new one which will roll the date ahead as needed. Convert
# to epoch seconds and back for the offset to work
datetime = time.localtime(time.mktime(time.struct_time(
datetime = time.localtime(time.mktime(time.struct_time((
datetime.tm_year,
datetime.tm_mon,
datetime.tm_mday,
datetime.tm_hour + hours_ahead,
datetime.tm_min,
datetime.tm_sec,
-1, -1, -1)))
-1, -1, -1))))
# strftime() not available here
url = ('https://api.met.no/weatherapi/sunrise/2.0/.json?lat=' +
str(LATITUDE) + '&lon=' + str(LONGITUDE) +
Expand Down

0 comments on commit a544133

Please sign in to comment.