summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/calendar.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 365ca26..fb56826 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -213,7 +213,7 @@ _EPOCH_ORD = datetime.date(EPOCH, 1, 1).toordinal()
def timegm(tuple):
"""Unrelated but handy function to calculate Unix timestamp from GMT."""
year, month, day, hour, minute, second = tuple[:6]
- days = datetime.date(year, month, day).toordinal() - _EPOCH_ORD
+ days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
hours = days*24 + hour
minutes = hours*60 + minute
seconds = minutes*60 + second