Compare commits

..

No commits in common. "d4ecf243ae7f1610ec1590d4b8acdf1935873fb4" and "2377e5e325b3ef620a018a33c601fa137f9dfd6f" have entirely different histories.

20
timezone.py Normal file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env python3
from datetime import datetime, tzinfo, timedelta
class TZMadrid(tzinfo):
def utcoffset(self, dt):
return timedelta(hours=1) + self.dst(dt)
def dst(self, dt):
dston = datetime.date(dt.year, 4, 1)
dstoff = datetime.date(dt.year, 10, 27)
# Code to set dston and dstoff to the time zone's DST
# transition times based on the input dt.year, and expressed
# in standard local time.
if dston <= dt.replace(tzinfo=None) < dstoff:
return timedelta(hours=1)
else:
return timedelta(0)