[Python-modules-commits] [python-pysolar] 08/42: Allowing UTC sunrise/sunset times
Wolfgang Borgert
debacle at moszumanska.debian.org
Fri Oct 3 23:36:58 UTC 2014
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to tag 0.6
in repository python-pysolar.
commit ae43f34deaf8929444b83326f372359d490383f7
Author: Will Hardy <will at willhardy.com.au>
Date: Tue Nov 19 18:44:36 2013 +0100
Allowing UTC sunrise/sunset times
---
Pysolar/util.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Pysolar/util.py b/Pysolar/util.py
index acc1b03..aa1f7f0 100644
--- a/Pysolar/util.py
+++ b/Pysolar/util.py
@@ -31,6 +31,7 @@
"""
from datetime import datetime as dt
+from datetime import timedelta
import math
import pytz
from pytz import all_timezones
@@ -647,10 +648,9 @@ def date_with_decimal_hour(date_utc, hour_decimal):
datetime_hour
"""
- hour_dms = (int(hour_decimal), int((hour_decimal-int(hour_decimal))*60), 0,)
+ # Backwards compatibility: round down to nearest round minute
+ offset_seconds = int(hour_decimal * 60) * 60
+ datetime_utc = dt(date_utc.year, date_utc.month, date_utc.day)
- datetime_hour = dt(date_utc.year, date_utc.month, date_utc.day,
- hour_dms[0], hour_dms[1],int(hour_dms[2]))
-
- return datetime_hour
+ return datetime_utc + timedelta(seconds=offset_seconds)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pysolar.git
More information about the Python-modules-commits
mailing list