Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 73 / ee181548f61afc29f56c9dd7e79af9b36f31e5
1 Return-Path: <blakej@foo.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 372A3431FB6\r
6         for <notmuch@notmuchmail.org>; Mon,  5 Nov 2012 10:33:21 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id NI2KjQv8GENl for <notmuch@notmuchmail.org>;\r
16         Mon,  5 Nov 2012 10:33:20 -0800 (PST)\r
17 Received: from foo.net (70-36-235-136.dsl.static.sonic.net [70.36.235.136])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 6B538431FAE\r
21         for <notmuch@notmuchmail.org>; Mon,  5 Nov 2012 10:33:20 -0800 (PST)\r
22 Received: from foo.net (localhost [127.0.0.1])\r
23         by foo.net (8.14.5+Sun/8.14.5) with ESMTP id qA5IXCca010300;\r
24         Mon, 5 Nov 2012 10:33:12 -0800 (PST)\r
25 To: Tomi Ollila <tomi.ollila@iki.fi>\r
26 Subject: Re: [PATCH 10/10] timegm: add portable implementation (Solaris\r
27         support) \r
28 In-Reply-To: Your message of "Mon, 05 Nov 2012 19:36:47 +0200."\r
29         <m2a9uwyms0.fsf@guru.guru-group.fi> \r
30 Date: Mon, 05 Nov 2012 10:33:12 -0800\r
31 Message-ID: <10299.1352140392@foo.net>\r
32 From: Blake Jones <blakej@foo.net>\r
33 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2\r
34         (foo.net [127.0.0.1]); Mon, 05 Nov 2012 10:33:13 -0800 (PST)\r
35 Cc: notmuch@notmuchmail.org\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Mon, 05 Nov 2012 18:33:21 -0000\r
49 \r
50 >> The other approaches rely on letting libc do all the hard work of\r
51 >> time zone manipulation, and then reading the tea leaves to find a way\r
52 >> to undo it.\r
53\r
54 > Did you look at the gnu libc version -- I bet it is pretty hairy...\r
55 \r
56 I didn't look at either the GNU or the Solaris libc version.  But the\r
57 file that implements the timezone handling (and localtime(), mktime(),\r
58 etc.) in Solaris' libc is nearly 3000 lines of code, so I suspect\r
59 there's an awful lot of stuff going on.\r
60 \r
61 >> For what it's worth, I used the attached program to test my\r
62 >> implementation, and it passed.\r
63\r
64 > Thanks, It's nice to see your simple implementation passes these\r
65 > tests...\r
66\r
67 > Just for curiosity: What do you think lacks in your timegm() that it\r
68 > could not be promoted as 'complete timegm() solution'.\r
69 \r
70 Well, since there isn't a standard for timegm(), I'm comparing it to\r
71 what glibc and BSD do.  The glibc mktime() man page, for example,\r
72 mentions that mktime() modifies the fields of the tm structure as\r
73 follows:\r
74 \r
75     - tm_wday and tm_yday are set to values determined from the contents\r
76       of the other fields\r
77 \r
78     - if structure members are outside their valid interval, they will\r
79       be normalized (so that, for example, 40 October is changed into 9\r
80       November)\r
81 \r
82     - tm_isdst is set (regardless of its initial value) to a positive\r
83       value or to 0, respectively, to indicate whether DST is or is not\r
84       in effect at the specified time.\r
85 \r
86     - Calling mktime() also sets the external variable tzname with\r
87       information about the current timezone. \r
88 \r
89 The corresponding timegm() man page for glibc doesn't say whether\r
90 timegm() does the same thing, but I would assume it does.  The FreeBSD\r
91 timegm() man page says that its version does update the fields of the\r
92 "tm" structure, like its mktime() implementation.\r
93 \r
94 My implementation of timegm() does none of these things.  It treats the\r
95 passed-in "struct tm" as constant, and just returns a valid time_t.  If\r
96 you really wanted to make this mktime() be as capable as the ones in the\r
97 GNU and BSD libc's, you could have it turn around and call gmtime_r() on\r
98 the generated time_t, and pass the original "struct tm" to gmtime_r().\r
99 Personally, I think this is unnecessary overloading of a function that\r
100 does this one thing just fine, and in practice Jani's code doesn't seem\r
101 to need it, so I didn't bother.\r
102 \r
103 > In any way, including this timegm() function in compat suits me fine.\r
104 \r
105 Great.\r
106 \r
107 Blake\r