From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.user Subject: Re: timestamp Date: Sat, 12 Feb 2022 13:32:58 +0100 Message-ID: References: <5cae853e6252bb3e38b1a20ff9ea960c1756c68c.camel@riseup.net> <9d45b2d6c007a8e9ca1e0656deed190f1181e035.camel@planete-kraus.eu> <098bbd5f1c81414521015479b7e2b17d8809f1bd.camel@riseup.net> <874k54tia0.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XR2dKBZuwOLfe3qz" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="988"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user@gnu.org To: Ricardo Wurmus Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Feb 12 13:34:23 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nIrba-000AYb-MV for guile-user@m.gmane-mx.org; Sat, 12 Feb 2022 13:34:22 +0100 Original-Received: from localhost ([::1]:43400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nIrbY-000606-KJ for guile-user@m.gmane-mx.org; Sat, 12 Feb 2022 07:34:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIrad-0005yI-U1 for guile-user@gnu.org; Sat, 12 Feb 2022 07:33:24 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:52018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIraQ-0001vF-Pm for guile-user@gnu.org; Sat, 12 Feb 2022 07:33:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=nsnTxJeph/KvKiR24XzsRzcJtHAQ+hjFdcnfQ6N7YI8=; b=Nyvi3Ce0ynSrt7/vogywl23Uw9 ieqQ9bUQhq/IU7+6MMdvWdax1+ys8aG3YRGqRMupjmF+bycG1ghXOOTI6JflfjpltolnqaFiXIrrt J1zZCD+Y9zEbvXoTH9anqoaP4U7/KgIkPEaOT0t8Zl3Ea1eGZqov4A8UbnKUeU7AOh6Q9+3p3W8ON onBpSD0sUno74IBXtaXTzquwJq9K+dQPfs3i/d8iQ+8Qd5TeLTnSLpL6qiuGoe7JQ4kkS+c74f/zY 1olfZCS47u72oZ9/KAnflVB+/qMvzMUATDa88UQ7lO2yKvJ9j/20cG8TnXDbdlr9XCjK2TQfiBZQ7 Y4KdbSCQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1nIraE-0007gH-7B; Sat, 12 Feb 2022 13:32:58 +0100 Content-Disposition: inline In-Reply-To: <874k54tia0.fsf@elephly.net> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18083 Archived-At: --XR2dKBZuwOLfe3qz Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 12, 2022 at 12:49:10PM +0100, Ricardo Wurmus wrote: >=20 > Hi adriano, >=20 > I=E2=80=99ve got no good answers as to =E2=80=9Cwhy=E2=80=9D things are t= he way they are, but > the manual explains the range of these values: >=20 > > It seesm to be > > > > (tm:mon %3) > > > > This returns > > > > 11 > > > > I expected 12 but ok, I recognize this kind of weirdness >=20 > -- Scheme Procedure: tm:mon tm > -- Scheme Procedure: set-tm:mon tm val > Month (0-11). >=20 > > I'm unhappy with=20 > > > > (tm:year $3) > > > > This returns > > > > 120 > > > > it's 2020 > > > > Why would 120 represent 2020 ? >=20 > -- Scheme Procedure: tm:year tm > -- Scheme Procedure: set-tm:year tm val > Year (70-), the year minus 1900. >=20 > I don=E2=80=99t know why this would be useful, but that=E2=80=99s what it= is =C2=AF\_(=E3=83=84)_/=C2=AF Oh. That is old POSIXy tradition :-) Guile actually only passes along what libc provides, and I think it is a good idea, in general. See the man page of localtime(3) on your next Linux-= ish box for all the details. If you prefer an online version, perhaps [1], [2] convey an idea. The year... those interfaces were developed well before the year 2000. It w= as usual, Back Then (TM) to write down the year as a two-digit number (the 19 prefix was implied). Nobody could predict that the year 2000 was about to arrive, honestly ;-) As to the month... zero based numberings ease computations and setting up name arrays (as in: 0: January, 1: February and so on). Don't ask me why, though, the day of the month (1..31) is one-based. It is the only exception :-) But it makes for an easy calculation where you can add up the year (times year length, taking leap years into account), the days-in-month so far for full months and the current month day and things to arrive at the current Epoch day. Guess one has to be one-based, otherwise you'll have to add 1 at the end. (This is all somewhat tongue-in-cheek ;-P But it illustrates some other point: for folks coming from C and POSIX, (I do), all that stuff feels "pretty natural", although it isn't, of course. Cheers [1] https://en.cppreference.com/w/c/chrono/localtime [2] https://en.cppreference.com/w/c/chrono/tm --=20 t --XR2dKBZuwOLfe3qz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCYgeo8gAKCRAFyCz1etHa RjJUAJwI7bJpvxtd9QNQ5/E7nfduCc1cygCeJP2ACuS3UuejbHuZ+XvvkYAJ6wo= =y490 -----END PGP SIGNATURE----- --XR2dKBZuwOLfe3qz--