X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=compat%2Ftimegm.c;fp=compat%2Ftimegm.c;h=005a42399d8e8b9afa63e33ef4278778709943d7;hp=3560c370f40c425ecf379fc3b9a9850355a515dc;hb=8099050c7191525c63b03e8b175620d2a2c1a9a3;hpb=1a8916786f9464af6c8a05713a4c987a6b097a12 diff --git a/compat/timegm.c b/compat/timegm.c index 3560c370..005a4239 100644 --- a/compat/timegm.c +++ b/compat/timegm.c @@ -1,19 +1,19 @@ /* timegm.c --- Implementation of replacement timegm function. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 3, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ /* Copyright 2013 Blake Jones. */ @@ -35,20 +35,20 @@ leapyear (int year) time_t timegm (struct tm *tm) { - int monthlen[2][12] = { + int monthlen[2][12] = { { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, }; - int year, month, days; + int year, month, days; days = 365 * (tm->tm_year - 70); for (year = 70; year < tm->tm_year; year++) { - if (leapyear(1900 + year)) { + if (leapyear (1900 + year)) { days++; } } for (month = 0; month < tm->tm_mon; month++) { - days += monthlen[leapyear(1900 + year)][month]; + days += monthlen[leapyear (1900 + year)][month]; } days += tm->tm_mday - 1;