Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp240189imj; Wed, 13 Feb 2019 07:34:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IYZCVCRG6tj5YMHfwzL+t/+AjsrLZDuljct6eUeOOW6SMtyCenTxUeYuyR4CLtrXBfSPGu4 X-Received: by 2002:a63:f253:: with SMTP id d19mr1026469pgk.14.1550072085051; Wed, 13 Feb 2019 07:34:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550072085; cv=none; d=google.com; s=arc-20160816; b=s6OAVA4YdznCuIy9fhw4IX6dTMwLwlXtJkVbKD9TmQnpjm5FNWOQ17u5Q9vJgl4acx QmnJyL3U72q7DpvjUYzRfF2i61NPnxAUNQM1tcsrWQ+RuSuO+EA4BP6HZVIz/Q1ZDMyu upZA38Sy6bE9Z/j+y23WwpshMLU/xgx1Ko0RowZbyxGdon2GtgHqT8BHxGSzeUDxb1NX VCbiMviJf6r3vl9+2TWQIxGnXhEKZy3y38luLRTrTGJ6kE1Fip+tD8k7mzYTnhwEqkRD HYzDhjKoZsUAWTjA4w83C9O2IcWAydmUk0bQBfycF+NAwmNa7fJqOQF3jjrhHoMNBuJR ELXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:subject:to:from:date :message-id; bh=jRsAWTVrH3SDiGmZnT5CwzaMzb3lv9Kcaf6li6GcoI0=; b=jZWu+Nq+h9QNuRzYPpnpKn8TZoTIg8mwGfkHMx3NdxYcVeB7thFd+HFn+KI6LJjzJx BqJyg9SZtkDLB1zJBdx8GRMJ1On9Vudqh9SY3qOc7fXtbNDo7xt2wJ9IRYRJL17eovgv mD8jibF5gvlia4W+N9xG80BGzo8K7C7BYV9/LIs9a0tuFlQCdPRLeENTwEWM9N3i3dRe 2n+gG2neO61pnX2QWMnAUksvle4Syrs6STrZnO1cACCqMS5+/YFTYSk/7K1gWwhiS4Ch yMrL+NwM5qdhZi7cANA6y4zb+qQPPJi/vFqxsHktt/ehbuqgAvpOZFKXs6DX7pq5PkmH xH6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si2747421pls.326.2019.02.13.07.34.23; Wed, 13 Feb 2019 07:34:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388433AbfBMPCb convert rfc822-to-8bit (ORCPT + 99 others); Wed, 13 Feb 2019 10:02:31 -0500 Received: from rrzmta1.uni-regensburg.de ([194.94.155.51]:58769 "EHLO rrzmta1.uni-regensburg.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfBMPCb (ORCPT ); Wed, 13 Feb 2019 10:02:31 -0500 X-Greylist: delayed 431 seconds by postgrey-1.27 at vger.kernel.org; Wed, 13 Feb 2019 10:02:30 EST Received: from rrzmta1.uni-regensburg.de (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 5C39667ED7 for ; Wed, 13 Feb 2019 15:55:17 +0100 (CET) Received: from gwsmtp1.uni-regensburg.de (gwsmtp1.uni-regensburg.de [132.199.5.51]) by rrzmta1.uni-regensburg.de (Postfix) with ESMTP id 40A8667ECA for ; Wed, 13 Feb 2019 15:55:17 +0100 (CET) Received: from uni-regensburg-smtp1-MTA by gwsmtp1.uni-regensburg.de with Novell_GroupWise; Wed, 13 Feb 2019 15:55:17 +0100 Message-Id: <5C642FD2020000A10002FAAA@gwsmtp1.uni-regensburg.de> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Wed, 13 Feb 2019 15:55:14 +0100 From: "Ulrich Windl" To: Subject: leap seconds and 61st second in minute Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! I was currently following some discussion on the topic of leap seconds, and due to the basic role of time in the kernel, I'd like to send a "heads up" ("food for thought") with some proposal (not to start some useless discussion): The UNIX timescale running in UTC had (I suppose) the idea that no timezone switches will affect it. Unfortunately leap-seconds have not been considered; maybe also because at that time everybody would be happy if the system's time was correct to a few seconds. I don't know. However leap seconds are a kind of "time zone switch" conceptually. Unfortunately the unix time scale does not consider them (as noted in the time(2) manual page). That's one part of posix. The other part of POSIX claims that during an inserted leap second there should be a 61st second in the minute. Unfortunately (AFAIK) there's no interface from kernel's leap second handling to glibc allowing it to actually return 60 as the number of seconds. (localtime(3) only gets a pointer to time_t) OTOH in the NTPv4 clock model there is a TAI offset included (which can be updated by NTP). AFAIK the kernel also has the timezone offset for some time to handle RTCs that run local time. Obviously if the kernel knew the number of leap seconds (the correction to the time() timescale) conversion from UNIX timescale to TAI would be easy. So roughly if the kernel exports the time and type of the next_leap second scheduled, some future localtime could actually return the 61st second in the minute. As it is now applications will all see some magic duplication of the 60th second. (Maybe that' why Google does "leap smear"). If the kernel API would also export the TAI offset, one could even offer a TAI-based time, or, maybe even better: The kernel could run on TAI internally, and convert to UNIX time scale as needed. I'll leave exact specification and implementation to the really clever guys. Regards, Ulrich P.S. Not subscribed to the kernel-list so if you want to talk to me keep me on CC: preferably