Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp392168lqh; Tue, 7 May 2024 02:20:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7hURTTlvwETWAZSlTE0GoPVQQE23m0kKeboTZTWSSKx/AN/ydkNEWRrhWPTf0mspIVhh9hdZAYn3SM281w38Ld1DukMLEEWxIrx/W9A== X-Google-Smtp-Source: AGHT+IExYwg32uc+EE4bimKgx2aBe9WfVmX7tQueLkD2EKKLsGXD/UoI5u56P6Qxz5z+UnNQW7j6 X-Received: by 2002:a05:6902:2405:b0:de6:1057:c856 with SMTP id dr5-20020a056902240500b00de61057c856mr18307385ybb.24.1715073633642; Tue, 07 May 2024 02:20:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715073633; cv=pass; d=google.com; s=arc-20160816; b=PkWt0AZ1AA2TyyK/xjDQHnbXUkB9v5+/YiLYMS8PvPJ6nqYNIILPwVtCsseAcuCxUm nJjJHT6DxlYVXkebahxcw27FzjKjh3a8e1QqJ6TsqUBBDun586ZVE6N1B1gqbme706eh EKK9nA+gHAUW9gtOfIUiW4ZtDSL4OUoWw/0B4/4PIwwetxlmGvJSonaan7Cfgw1PFukN htAd9GHkdk54dq3QLrVDGmoSvFoneswGjTWuicP56fq5lZakPlEFx9R9ZZJndlAQ8Tnm fdSsyEbNcs/Yy111Y07DLVpHCiM5CwE3Y+i17cBz8kMa9+8I79FwFB3Th2d1gc3LDsxc Bmzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=chLGU6l6hNJKBpFcSgd0l6Eq/cnfB6SXMbkZ/m84z/E=; fh=ttmCHTEx0J7gVbpdPTuwp8tjz3WamIYVUHrQmgMJvbE=; b=E1XXq9BGq/onAVTEUbROCzf3gx2XqTIEYU8/BCzQalmxMLh8mrbFH04q2mlSZBoxqP 1Di1mAmhScT4ZyCL14qUxvKij7GbRkM9+DvD5BBxYNTYv5cPY5dNSjIYTBzgX8+HiXjk 5aKYcJA8M9HOgf8JPASiNH4oZKNR1FBjXvAiSw4lxLNTCwwpfwfYSFPWEM/jCYKTy8x5 RFYlnYwkEpB4cT3RYOrlIAV3NeGylw014EUDkzQVi7B6zk0ji4wL1nb83UFylX6teRRl QOL8UN62Ia8O+x/YIYt0By88GCrMI8ySLqTq15by8lQ5IEXHCq56OmY4xxXX1g8gmpFc NVow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=andestech.com dmarc=pass fromdomain=andestech.com); spf=pass (google.com: domain of linux-kernel+bounces-170929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=andestech.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a21-20020a05622a02d500b00437bd2a532dsi11361840qtx.120.2024.05.07.02.20.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=andestech.com dmarc=pass fromdomain=andestech.com); spf=pass (google.com: domain of linux-kernel+bounces-170929-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170929-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=andestech.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 60D3E1C21A17 for ; Tue, 7 May 2024 09:20:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 17D3D14D71A; Tue, 7 May 2024 09:20:18 +0000 (UTC) Received: from Atcsqr.andestech.com (60-248-80-70.hinet-ip.hinet.net [60.248.80.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 024D414D2BF for ; Tue, 7 May 2024 09:20:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.248.80.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715073617; cv=none; b=iweMJsYUQKdMQ0IPAEGT7Fz7CjIRrRCgCnCxrla795Ujuqwj+en0RkrdNAv0VXlGQ27eVpgAga8CmTMFoRpLBI++ZdED5xoiEtpCophmNZ8oYbLhFNj8KS06A8j+K13wEjjg744GQJm7c+GuAB1BwyyR72QOkyQxQ6cIp3jZJhs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715073617; c=relaxed/simple; bh=wmfxCx98oiGEm0S2u+uUju/dQan/1Xv1qYRtUIqEhig=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=OpLwmLsh8NP55aJWhqlSEki77AeBX0OwN/f8EyE04adOPcdBAdr8i+BNrs19xqkdP90Cu+MwdUUS4rqIkdTWh0rJP085yQRVlzGw/ceHpdZYxTcO2496gcxAn24nljrzhbRnIaY7PdOSlS43fzS6OiQ/FHJ2CbW0dGdneEWTVhU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=andestech.com; spf=pass smtp.mailfrom=andestech.com; arc=none smtp.client-ip=60.248.80.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=andestech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=andestech.com Received: from Atcsqr.andestech.com (localhost [127.0.0.2] (may be forged)) by Atcsqr.andestech.com with ESMTP id 44793Dkq098770 for ; Tue, 7 May 2024 17:03:13 +0800 (+08) (envelope-from ben717@andestech.com) Received: from mail.andestech.com (ATCPCS16.andestech.com [10.0.1.222]) by Atcsqr.andestech.com with ESMTP id 447931Cg098720; Tue, 7 May 2024 17:03:01 +0800 (+08) (envelope-from ben717@andestech.com) Received: from atctrx.andestech.com (10.0.15.190) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.498.0; Tue, 7 May 2024 17:03:01 +0800 From: Ben Zong-You Xie To: , CC: , , , , , , , Ben Zong-You Xie Subject: [PATCH v2] perf daemon: Fix the warning about time_t Date: Tue, 7 May 2024 17:02:41 +0800 Message-ID: <20240507090241.3853998-1-ben717@andestech.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL:Atcsqr.andestech.com 44793Dkq098770 On the 32-bit platform, the size of time_t is 32 bits or 64 bits according to the architecture. Therefore, use typecasting to resolve the warnings for some architectures, e.g. RISC-V. Signed-off-by: Ben Zong-You Xie --- v2: By Palmer's remind, patch v1 may introduce a warning for some other targets. Thus, use typecasting instead. --- tools/perf/builtin-daemon.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c index 83954af36753..cb04caa902e8 100644 --- a/tools/perf/builtin-daemon.c +++ b/tools/perf/builtin-daemon.c @@ -688,9 +688,10 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out) /* lock */ csv_sep, daemon->base, "lock"); - fprintf(out, "%c%lu", + fprintf(out, "%c%llu", /* session up time */ - csv_sep, (curr - daemon->start) / 60); + csv_sep, + (unsigned long long)((curr - daemon->start) / 60)); fprintf(out, "\n"); } else { @@ -700,8 +701,8 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out) daemon->base, SESSION_OUTPUT); fprintf(out, " lock: %s/lock\n", daemon->base); - fprintf(out, " up: %lu minutes\n", - (curr - daemon->start) / 60); + fprintf(out, " up: %llu minutes\n", + (unsigned long long)((curr - daemon->start) / 60)); } } @@ -727,9 +728,10 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out) /* session ack */ csv_sep, session->base, SESSION_ACK); - fprintf(out, "%c%lu", + fprintf(out, "%c%llu", /* session up time */ - csv_sep, (curr - session->start) / 60); + csv_sep, + (unsigned long long)((curr - session->start) / 60)); fprintf(out, "\n"); } else { @@ -745,8 +747,8 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out) session->base, SESSION_CONTROL); fprintf(out, " ack: %s/%s\n", session->base, SESSION_ACK); - fprintf(out, " up: %lu minutes\n", - (curr - session->start) / 60); + fprintf(out, " up: %llu minutes\n", + (unsigned long long)((curr - session->start) / 60)); } } -- 2.34.1