From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by sourceware.org (Postfix) with ESMTPS id 4D0C93858024 for ; Sun, 18 Oct 2020 13:09:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4D0C93858024 Received: by mail-wm1-x342.google.com with SMTP id d81so7728652wmc.1 for ; Sun, 18 Oct 2020 06:09:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:cc:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=F5n+8TP73RPv4xPOWs2aopDNKSCsvENL2ALIGM5VyAQ=; b=hYjV+/hSnuXnlOokMeWlZl5DUWvN4GQY2JZPU4hSYSnBioFpaTHmpvi9iMcE4IXkCz VJwpxLfLZDyZ9O6JfKlJ7l+fIJXdmZj3O5gTRLcNYWpDbgm3psTglwkis/c98SL0hqH/ IhElIXczwjYSZFc0Qwlejuss01B626nsFrR+vr7FHxFnIpInBCLxlLLGSbKHMsMKFqJt +KhySI6IuGrPTYAhyhJLbKbRf8OpL077Hl/sbd6m6z6ECbxLoPZtkylgNbA5z3v92klm LemYkaykzX2PPO4lJN/7Yvlrp5AkJFFS88H2vN+iDU1T8cWCWkfhXB8JhIsX/SjSxJZZ IAjg== X-Gm-Message-State: AOAM533Qs6cdh4HsAWyBqcThOPgyXScGc8Wgh0gHOgJv6jMn9gpnhRC0 RsmH2+81hg5/agWgc5RLwHGUW+Zfg8Q= X-Google-Smtp-Source: ABdhPJzVpwhJqwtGUx9kfcEwITbQXXTKsdq3OzGdOdQexFXXemQU4v+Nqv7VnDGqoHIty+ZUptBWUg== X-Received: by 2002:a1c:2d8f:: with SMTP id t137mr12665983wmt.26.1603026560177; Sun, 18 Oct 2020 06:09:20 -0700 (PDT) Received: from [192.168.1.10] (static-176-175-73-29.ftth.abo.bbox.fr. [176.175.73.29]) by smtp.gmail.com with ESMTPSA id c18sm13472383wrq.5.2020.10.18.06.09.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Oct 2020 06:09:19 -0700 (PDT) Cc: mtk.manpages@gmail.com, linux-man@vger.kernel.org, libc-alpha@sourceware.org Subject: Re: [PATCH 2/3] system_data_types.7: Add 'clock_t' To: Alejandro Colomar References: <20201017213758.9270-1-colomar.6.4.3@gmail.com> <20201017213758.9270-2-colomar.6.4.3@gmail.com> From: "Michael Kerrisk (man-pages)" Message-ID: Date: Sun, 18 Oct 2020 15:09:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Oct 2020 13:09:22 -0000 Hello Alex, >> This type has a strange history. In my book, I note: >> >> Although the clock_t return type of clock() is the same >> data type that is used in the times() call, the units of >> measurement employed by these two interfaces are >> different. This is the result of historically conflicting >> definitions of clock_t in POSIX.1 and the C programming >> language standard. > > > Ahhh now I get it. So CLOCKS_PER_SEC doesn't mean CLOCK_TICKS_PER_SEC, > right? I always thought that it really was that, and clock() simply > returned clock ticks. But it looks like it returns an arbitrary > division of the second called CLOCKS_PER_SEC. More or less. But the standard also says (in the spec): The value of CLOCKS_PER_SEC shall be 1 million on XSI-conformant systems. (Yes, it is odd.) Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/