Unrelated but handy function to calculate Unix timestamp from GMT.
(tuple)
| 651 | |
| 652 | |
| 653 | def timegm(tuple): |
| 654 | """Unrelated but handy function to calculate Unix timestamp from GMT.""" |
| 655 | year, month, day, hour, minute, second = tuple[:6] |
| 656 | days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1 |
| 657 | hours = days*24 + hour |
| 658 | minutes = hours*60 + minute |
| 659 | seconds = minutes*60 + second |
| 660 | return seconds |
| 661 | |
| 662 | |
| 663 | def main(args): |
no test coverage detected