Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760105Ab3IDSwB (ORCPT ); Wed, 4 Sep 2013 14:52:01 -0400 Received: from mail-vc0-f177.google.com ([209.85.220.177]:59019 "EHLO mail-vc0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759751Ab3IDSv7 (ORCPT ); Wed, 4 Sep 2013 14:51:59 -0400 MIME-Version: 1.0 In-Reply-To: <5226FAE1.5070201@fb.com> References: <5226FAE1.5070201@fb.com> From: Andy Lutomirski Date: Wed, 4 Sep 2013 11:51:38 -0700 Message-ID: Subject: Re: clock_gettime_ns To: Arun Sharma Cc: LKML , Kumar Sundararajan , John Stultz Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1698 Lines: 52 I think that most of the hangup was a lack of agreement on how the API should work wrt leap seconds. I've always thought that the Right Way to represent a UTC time is nanoseconds since some epoch, where every potential leap second counts. Pros: - Unambiguously convertible to and from year/month/day/hour/minute/second/nanosecond. - Monotonic - Compact Cons: - Computing differences between timestamps requires a table. (Note: y/m/d/h/m/s/ns has the same problem.) - Weird: no one does this - If you naively subtract times, you end up with jumps forward. (But jumps forward are much less likely to break things than jumps backwards.) - Almost, but not quite, compatible with timespec, so it could cause confusion. If someone wants a hard problem, find a way to implement clock_gettime that almost never spins or otherwise block and is continuous. I've thought about it a bit and have something that almost works. --Andy On Wed, Sep 4, 2013 at 2:18 AM, Arun Sharma wrote: > A couple of years ago Andy posted this patch series: > > http://thread.gmane.org/gmane.linux.kernel/1233209/ > > These patches have been in use at facebook for a couple of years and along > with a vDSO implementation of thread_cpu_time(), they have proven useful for > our profilers. > > I didn't see any arguments against this patch series. Did I miss some > discussion on the topic? > > -Arun -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/