Unrelated but handy function to calculate Unix timestamp from GMT.
(tuple)
| 799 | |
| 800 | |
| 801 | def timegm(tuple): |
| 802 | """Unrelated but handy function to calculate Unix timestamp from GMT.""" |
| 803 | year, month, day, hour, minute, second = tuple[:6] |
| 804 | days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1 |
| 805 | hours = days*24 + hour |
| 806 | minutes = hours*60 + minute |
| 807 | seconds = minutes*60 + second |
| 808 | return seconds |
| 809 | |
| 810 | |
| 811 | def main(args=None): |
no test coverage detected