I'm having some difficulty using pyEphem to get accurate sunrise and sunset times for my location. I have read a few questions and answers, and looked at the docs, but it's still not totally clear what I'm doing wrong. Here is the code:
import datetime as dt
import ephem as ep
date = dt.datetime.now().strftime("%Y/%m/%d 00:00:00")
lat, lon = [<redacted>, -1.4147]
# Use lat and lon to create ephem observer instance and update with given
# values
my_location = ep.Observer()
my_location.lat = lat
my_location.lon = lon
my_location.date = date
# Get sunrise of the current day
sunrise = my_location.next_rising(ep.Sun())
sunset = my_location.next_setting(ep.Sun())
print "Given date: {0}".format(date)
print "Detected coordinates: {0}, {1}".format(lat, lon)
print "Sunrise at {0}".format(sunrise)
print " Sunset at {0}".format(sunset)
Which produces this output:
Given date: 2015/01/31 00:00:00
Detected coordinates: <redacted>, -1.4147
Sunrise at 2015/1/31 12:28:02
Sunset at 2015/1/31 22:47:39
What I was expecting was to get the times of the first sunrise after midnight (this morning) and the first sunset after that. Now I happen to know the sun came up before 12:30 today (I was walking down the road at 9:30am in broad daylight) and I don't think there's a UTC offset since I know my timezone.
What am I missing?