Re: 64bit time_t

Tony Finch <dot@dotat.at> Sun, 22 June 2008 20:02 UTC

Return-Path: <ietf-bounces@ietf.org>
X-Original-To: ietf-archive@megatron.ietf.org
Delivered-To: ietfarch-ietf-archive@core3.amsl.com
Received: from [127.0.0.1] (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 7B3B03A67FC; Sun, 22 Jun 2008 13:02:33 -0700 (PDT)
X-Original-To: ietf@core3.amsl.com
Delivered-To: ietf@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 8FE373A680C for <ietf@core3.amsl.com>; Sun, 22 Jun 2008 13:02:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.999
X-Spam-Level:
X-Spam-Status: No, score=-3.999 tagged_above=-999 required=5 tests=[BAYES_50=0.001, RCVD_IN_DNSWL_MED=-4]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GKVE9zwAs1Op for <ietf@core3.amsl.com>; Sun, 22 Jun 2008 13:02:31 -0700 (PDT)
Received: from ppsw-5.csi.cam.ac.uk (ppsw-5.csi.cam.ac.uk [131.111.8.135]) by core3.amsl.com (Postfix) with ESMTP id 28C133A63D3 for <ietf@ietf.org>; Sun, 22 Jun 2008 13:02:30 -0700 (PDT)
X-Cam-SpamDetails: Not scanned
X-Cam-AntiVirus: No virus found
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from hermes-1.csi.cam.ac.uk ([131.111.8.51]:40170) by ppsw-5.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.155]:25) with esmtpa (EXTERNAL:fanf2) id 1KAVlg-0002HO-Gq (Exim 4.67) (return-path <fanf2@hermes.cam.ac.uk>); Sun, 22 Jun 2008 21:02:32 +0100
Received: from fanf2 (helo=localhost) by hermes-1.csi.cam.ac.uk (hermes.cam.ac.uk) with local-esmtp id 1KAVlg-0003of-6b (Exim 4.67) (return-path <fanf2@hermes.cam.ac.uk>); Sun, 22 Jun 2008 21:02:32 +0100
Date: Sun, 22 Jun 2008 21:02:32 +0100
From: Tony Finch <dot@dotat.at>
X-X-Sender: fanf2@hermes-1.csi.cam.ac.uk
To: Chad Giffin <typosity@hotmail.com>
Subject: Re: 64bit time_t
In-Reply-To: <BLU120-W240BCEF0CF3ACCC84DFBF3CAA40@phx.gbl>
Message-ID: <alpine.LSU.1.10.0806222035330.28974@hermes-1.csi.cam.ac.uk>
References: <BLU120-W240BCEF0CF3ACCC84DFBF3CAA40@phx.gbl>
User-Agent: Alpine 1.10 (LSU 962 2008-03-14)
MIME-Version: 1.0
Cc: IETF <ietf@ietf.org>
X-BeenThere: ietf@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: IETF Discussion <ietf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/ietf>, <mailto:ietf-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/pipermail/ietf>
List-Post: <mailto:ietf@ietf.org>
List-Help: <mailto:ietf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf>, <mailto:ietf-request@ietf.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: ietf-bounces@ietf.org
Errors-To: ietf-bounces@ietf.org

On Sat, 21 Jun 2008, Chad Giffin wrote:
>
> We currently (normally) store time as the number of elapsed seconds
> since January 1st 1970 GMT.

NTP represents time as an unsigned 32 bit integral number of seconds since
1900-01-01 00:00:00 plus 32 bits of fraction, i.e. the whole timestamp is
64 bit fixed point. This wraps a couple of years before 32 bit Unix time_t.

The TICTOC working group was recently chartered to specify highly accurate
time and frequency distribution. See
http://www.ietf.org/html.charters/tictoc-charter.html

It's not possible to specify a timestamp format that both fits in 64 bits
and has sufficient range and precision to be useful for most purposes.
FreeBSD's bintime format uses standard time_t (eventually 64 bits) plus 64
bits of fractional seconds, i.e. the whole timestamp is 128 bit fixed
point. The high precision avoids aliasing problems when representing
multi-GHz clock frequencies (e.g. CPU clocks).

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
HEBRIDES BAILEY: NORTH 5 TO 7, BUT GALE 8 AT FIRST IN HEBRIDES, BACKING WEST 3
OR 4 LATER. ROUGH OR VERY ROUGH, DECREASING MODERATE LATER. SHOWERS. GOOD.
_______________________________________________
IETF mailing list
IETF@ietf.org
https://www.ietf.org/mailman/listinfo/ietf