From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.devel Subject: Re: Represent NTP's origin time Date: Thu, 15 Apr 2021 14:06:09 +0000 Message-ID: <3ed97a9c535036fc5a67@heytings.org> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZtjeFcMR1n" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6931"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ulrich Mueller , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 15 16:07:46 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lX2eo-0001hF-Eh for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Apr 2021 16:07:46 +0200 Original-Received: from localhost ([::1]:36580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lX2en-0005kQ-Dn for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Apr 2021 10:07:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2dQ-00045L-69 for emacs-devel@gnu.org; Thu, 15 Apr 2021 10:06:21 -0400 Original-Received: from heytings.org ([95.142.160.155]:43110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2dI-0005yu-AU for emacs-devel@gnu.org; Thu, 15 Apr 2021 10:06:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1618495569; bh=3fPXW7EbVs8pF3/RMboQWAnIzNwpQE62EDqAul5d9so=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=q0cW/GwOGpyN0uYKbCQi1DAZ9GdlEjZqYDEnsQi3I4ZeDfkTWc81Slzvl++8UygQA NUj0xgin0xwSCpP4FepI5s8ZecILSOOJEJGuN54OaNivifcY5+P9mOFsZbF5QohwXw r4elSAAdlud6XUzX24ERccVl+S9WUh8Zo+fUGd9jm47etOyYF0xnzFKMgqj0cTlJww fZSUUw4E0jpWHrZcySXQ5XK98OHgaY4BWHtr/mLOHKSwSUAyAKQJQzxJoQ+0QWydTP H3Nux+QwkdAgm6Q89xXwLawHeP0y1LP+hH6qmKNE2H6MUgAxdoWUCmeh5y/tpT+Q4X lrcFzqDSv5M0w== In-Reply-To: Received-SPF: pass client-ip=95.142.160.155; envelope-from=gregory@heytings.org; helo=heytings.org 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_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:268096 Archived-At: --ZtjeFcMR1n Content-Type: text/plain; format=flowed; charset=utf-8 Content-Transfer-Encoding: quoted-printable > > So, getting back to the question: Do we have some "standard" workaround?= =20 > I don't actually need to represent times from the early 20th century,=20 > but I need to compute NTP timestamps. I can come up with my own=20 > workaround (e.g. hardcoding as a "magic constant" the number of seconds= =20 > between NTP's origin time and some arbitrary other origin time of my=20 > choosing which 32bit systems can represent), but I was hoping we already= =20 > have something like that somewhere. > Apparently there is no standard workaround in Emacs. So on a 32bit=20 system, I would use the constant 2208988800 (25567 days times 86400=20 seconds), to represent the difference in seconds between 1900-01-01 and=20 1970-01-01 (epoch). This constant is given in the very first NTP RFC=C2=A0= [1],=20 and doing this should be safe: the current NTP format (32 bits for the=20 integer part) will work until Feb 7, 2036, that is, before 32-bit counting= =20 after epoch will stop working on Jan 19, 2038. [1] https://tools.ietf.org/html/rfc868 --ZtjeFcMR1n--