All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Replacing ktime_get because elapsedRealtime includes time spent in sleep and pps should be also including sleep time.
@ 2022-01-17  7:38 Alexander Komrakov
  2022-02-15  8:26 ` Rodolfo Giometti
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Komrakov @ 2022-01-17  7:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: giometti, alexander komrakov

[-- Attachment #1: Type: text/plain, Size: 1438 bytes --]

From: alexander komrakov <alexander.komrakov@broadcom.com>

Signed-off-by: alexander komrakov <alexander.komrakov@broadcom.com>
---
 drivers/pps/kapi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index 149c29e498fc..6d1fbe4a8c40 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -38,7 +38,7 @@ static __u64 clock_gettime(struct pps_ktime *kt)
 {
 	struct timespec64 ts = { .tv_sec = 0, .tv_nsec = 0 };
 
-	ktime_get_ts64(&ts);
+	ktime_get_boottime_ts64(&ts);
 	kt->sec = ts.tv_sec;
 	kt->nsec = ts.tv_nsec;
 	return (__u64) ts.tv_sec * NANOSEC_PER_SEC + ts.tv_nsec;
-- 
2.25.1


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4222 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Replacing ktime_get because elapsedRealtime includes time spent in sleep and pps should be also including sleep time.
  2022-01-17  7:38 [PATCH] Replacing ktime_get because elapsedRealtime includes time spent in sleep and pps should be also including sleep time Alexander Komrakov
@ 2022-02-15  8:26 ` Rodolfo Giometti
  0 siblings, 0 replies; 2+ messages in thread
From: Rodolfo Giometti @ 2022-02-15  8:26 UTC (permalink / raw)
  To: Alexander Komrakov, linux-kernel

On 17/01/22 08:38, Alexander Komrakov wrote:
> From: alexander komrakov <alexander.komrakov@broadcom.com>

Very long subject and missed description.

Let me suggest to replace the subject as "pps kapi: use 
ktime_get_boottime_ts64() to include time spent in sleep".

And add a description as:

Since ktime_get() stops during suspend, we replace it with 
ktime_get_boottime_ts64() because elapsed realtime includes time spent in sleep 
and pps should be also including sleep time.

Ciao,

Rodolfo

> Signed-off-by: alexander komrakov <alexander.komrakov@broadcom.com>
> ---
>   drivers/pps/kapi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
> index 149c29e498fc..6d1fbe4a8c40 100644
> --- a/drivers/pps/kapi.c
> +++ b/drivers/pps/kapi.c
> @@ -38,7 +38,7 @@ static __u64 clock_gettime(struct pps_ktime *kt)
>   {
>   	struct timespec64 ts = { .tv_sec = 0, .tv_nsec = 0 };
>   
> -	ktime_get_ts64(&ts);
> +	ktime_get_boottime_ts64(&ts);
>   	kt->sec = ts.tv_sec;
>   	kt->nsec = ts.tv_nsec;
>   	return (__u64) ts.tv_sec * NANOSEC_PER_SEC + ts.tv_nsec;

-- 
GNU/Linux Solutions                  e-mail: giometti@enneenne.com
Linux Device Driver                          giometti@linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-15  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17  7:38 [PATCH] Replacing ktime_get because elapsedRealtime includes time spent in sleep and pps should be also including sleep time Alexander Komrakov
2022-02-15  8:26 ` Rodolfo Giometti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.