I struggling to find an elegant way to set the ephem observer time to midnight local time. That is convert from midnight local time to ephem's UTC.
ephem uses next_rising to find the next sunrise time. Problem is if the local time is already past sunrise if gives you tomorrows sunrise.
I want to set my observer time to midnight local time so the next_rising , next_setting and next_transit are for the current day.
Going round in circles with python datetime stuff.
import ephem
home = ephem.Observer()
home.date = ephem.now()
home.lat = str(-37.8136)
home.lon = str(144.9631)
sunrise = home.next_rising( ephem.Sun() )
print home.date
# 2018/3/13 05:54:04
print ephem.localtime( home.date )
# 2018-03-13 16:54:03.000001 - current date is 13th March
print sunrise
# 2018/3/13 20:16:38 - sunrise in UTC
print ephem.localtime( sunrise )
# 2018-03-14 07:16:37.000002 - next date sunrise 14th March