--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 0D09B431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 20 Aug 2013 09:04:03 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 7-nLPcIZgLx7 for <notmuch@notmuchmail.org>;\r
+ Tue, 20 Aug 2013 09:03:53 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id CB75C431E62\r
+ for <notmuch@notmuchmail.org>; Tue, 20 Aug 2013 09:03:48 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 12FB2100086;\r
+ Tue, 20 Aug 2013 19:03:42 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Blake Jones <blakej@foo.net>, Vladimir.Marek@oracle.com\r
+Subject: Re: [PATCH 4/4] timegm: add portable implementation (Solaris support)\r
+In-Reply-To: <14321.1377012799@foo.net>\r
+References: <14321.1377012799@foo.net>\r
+User-Agent: Notmuch/0.16+3~g340c058 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Tue, 20 Aug 2013 19:03:42 +0300\r
+Message-ID: <m2bo4sfixt.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+Cc: notmuch@notmuchmail.org, Vladimir Marek <vlmarek@volny.cz>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 20 Aug 2013 16:04:03 -0000\r
+\r
+On Tue, Aug 20 2013, Blake Jones <blakej@foo.net> wrote:\r
+\r
+>> From: Blake Jones <blakej@foo.net>\r
+>> \r
+>> The timegm(3) function is a non-standard extension to libc which is\r
+>> available in GNU libc and on some BSDs. Although SunOS had this\r
+>> function in its libc, Solaris (unfortunately) removed it. This patch\r
+>> implements a very simple version of timegm() which is good enough for\r
+>> parse-time-string.c.\r
+>\r
+> LGTM.\r
+>\r
+> Blake\r
+\r
+\r
+Thanks Blake for your quick answer to my (perhaps too quick) question.\r
+\r
+The copyright header gives FSF "owner"ship to the file -- which would be fine\r
+by the project -- but does assigning copyright to the FSF work like this...\r
+... I started to look around and found (among other pages) this:\r
+\r
+http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/Copyright/conditions.text;h=6e19adf0233900c9169e10fe7e0aa8d1feb73996;hb=HEAD\r
+\r
+Maybe for liability reasons FSF needs more than just stating the copyright\r
+at the beginning of file... I don't know -- but if this is the case maybe\r
+the easiest thing is to remove (amend) the Copyright line out of the file.\r
+\r
+In getline.c, and getdelim.c the code is taken from glibc. What I've \r
+understood this timegm.c is new art ?\r
+\r
+IMHO this uncertainty is the last thing preventing putting this series\r
+to the nmbug ready (to be pushed) queue...\r
+\r
+Tomi\r
+\r
+>\r
+>> Signed-off-by: Vladimir Marek <vlmarek@volny.cz>\r
+>> ---\r
+>> compat/Makefile.local | 4 +++\r
+>> compat/compat.h | 5 +++\r
+>> compat/have_timegm.c | 7 ++++\r
+>> compat/timegm.c | 57 +++++++++++++++++++++++++++++++++\r
+>> configure | 11 +++++++\r
+>> parse-time-string/parse-time-string.c | 1 +\r
+>> 6 files changed, 85 insertions(+)\r
+>> create mode 100644 compat/have_timegm.c\r
+>> create mode 100644 compat/timegm.c\r
+>> \r
+>> diff --git a/compat/Makefile.local b/compat/Makefile.local\r
+>> index 2c4f65f..b0d5417 100644\r
+>> --- a/compat/Makefile.local\r
+>> +++ b/compat/Makefile.local\r
+>> @@ -17,4 +17,8 @@ ifneq ($(HAVE_STRSEP),1)\r
+>> notmuch_compat_srcs += $(dir)/strsep.c\r
+>> endif\r
+>> \r
+>> +ifneq ($(HAVE_TIMEGM),1)\r
+>> +notmuch_compat_srcs += $(dir)/timegm.c\r
+>> +endif\r
+>> +\r
+>> SRCS := $(SRCS) $(notmuch_compat_srcs)\r
+>> diff --git a/compat/compat.h b/compat/compat.h\r
+>> index ae762c3..5a402d5 100644\r
+>> --- a/compat/compat.h\r
+>> +++ b/compat/compat.h\r
+>> @@ -57,6 +57,11 @@ char* strcasestr(const char *haystack, const char *needle);\r
+>> char *strsep(char **stringp, const char *delim);\r
+>> #endif /* !HAVE_STRSEP */\r
+>> \r
+>> +#if !HAVE_TIMEGM\r
+>> +#include <time.h>\r
+>> +time_t timegm (struct tm *tm);\r
+>> +#endif /* !HAVE_TIMEGM */\r
+>> +\r
+>> /* Silence gcc warnings about unused results. These warnings exist\r
+>> * for a reason; any use of this needs to be justified. */\r
+>> #ifdef __GNUC__\r
+>> diff --git a/compat/have_timegm.c b/compat/have_timegm.c\r
+>> new file mode 100644\r
+>> index 0000000..b62b793\r
+>> --- /dev/null\r
+>> +++ b/compat/have_timegm.c\r
+>> @@ -0,0 +1,7 @@\r
+>> +#include <time.h>\r
+>> +#include "compat.h"\r
+>> +\r
+>> +int main()\r
+>> +{\r
+>> + return (int) timegm((struct tm *)0);\r
+>> +}\r
+>> diff --git a/compat/timegm.c b/compat/timegm.c\r
+>> new file mode 100644\r
+>> index 0000000..213963b\r
+>> --- /dev/null\r
+>> +++ b/compat/timegm.c\r
+>> @@ -0,0 +1,57 @@\r
+>> +/* timegm.c --- Implementation of replacement timegm function.\r
+>> + Copyright (C) 2012 Free Software Foundation, Inc.\r
+>> +\r
+>> + This program is free software; you can redistribute it and/or\r
+>> + modify it under the terms of the GNU General Public License as\r
+>> + published by the Free Software Foundation; either version 3, or (at\r
+>> + your option) any later version.\r
+>> +\r
+>> + This program is distributed in the hope that it will be useful, but\r
+>> + WITHOUT ANY WARRANTY; without even the implied warranty of\r
+>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+>> + General Public License for more details.\r
+>> +\r
+>> + You should have received a copy of the GNU General Public License\r
+>> + along with this program; if not, write to the Free Software\r
+>> + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
+>> + 02110-1301, USA. */\r
+>> +\r
+>> +/* Written by Blake Jones. */\r
+>> +\r
+>> +#include <time.h>\r
+>> +#include "compat.h"\r
+>> +\r
+>> +static int\r
+>> +leapyear (int year)\r
+>> +{\r
+>> + return ((year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0));\r
+>> +}\r
+>> +\r
+>> +/*\r
+>> + * This is a simple implementation of timegm() which does what is needed\r
+>> + * by create_output() -- just turns the "struct tm" into a GMT time_t.\r
+>> + * It does not normalize any of the fields of the "struct tm", nor does\r
+>> + * it set tm_wday or tm_yday.\r
+>> + */\r
+>> +time_t\r
+>> +timegm (struct tm *tm)\r
+>> +{\r
+>> + int monthlen[2][12] = {\r
+>> + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },\r
+>> + { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },\r
+>> + };\r
+>> + int year, month, days;\r
+>> +\r
+>> + days = 365 * (tm->tm_year - 70);\r
+>> + for (year = 70; year < tm->tm_year; year++) {\r
+>> + if (leapyear(1900 + year)) {\r
+>> + days++;\r
+>> + }\r
+>> + }\r
+>> + for (month = 0; month < tm->tm_mon; month++) {\r
+>> + days += monthlen[leapyear(1900 + year)][month];\r
+>> + }\r
+>> + days += tm->tm_mday - 1;\r
+>> +\r
+>> + return ((((days * 24) + tm->tm_hour) * 60 + tm->tm_min) * 60 + tm->tm_sec);\r
+>> +}\r
+>> diff --git a/configure b/configure\r
+>> index ac44857..6166917 100755\r
+>> --- a/configure\r
+>> +++ b/configure\r
+>> @@ -530,6 +530,17 @@ else\r
+>> fi\r
+>> rm -f compat/have_strsep\r
+>> \r
+>> +printf "Checking for timegm... "\r
+>> +if ${CC} -o compat/have_timegm "$srcdir"/compat/have_timegm.c > /dev/null 2>&1\r
+>> +then\r
+>> + printf "Yes.\n"\r
+>> + have_timegm="1"\r
+>> +else\r
+>> + printf "No (will use our own instead).\n"\r
+>> + have_timegm="0"\r
+>> +fi\r
+>> +rm -f compat/have_timegm\r
+>> +\r
+>> printf "Checking for standard version of getpwuid_r... "\r
+>> if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1\r
+>> then\r
+>> diff --git a/parse-time-string/parse-time-string.c b/parse-time-string/parse-time-string.c\r
+>> index 584067d..ccad422 100644\r
+>> --- a/parse-time-string/parse-time-string.c\r
+>> +++ b/parse-time-string/parse-time-string.c\r
+>> @@ -32,6 +32,7 @@\r
+>> #include <sys/time.h>\r
+>> #include <sys/types.h>\r
+>> \r
+>> +#include "compat.h"\r
+>> #include "parse-time-string.h"\r
+>> \r
+>> /*\r
+>> -- \r
+>> 1.7.9.2\r
+>> \r
+>> _______________________________________________\r
+>> notmuch mailing list\r
+>> notmuch@notmuchmail.org\r
+>> http://notmuchmail.org/mailman/listinfo/notmuch\r
+>> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r