All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Corey Minyard" <minyard@acm.org>,
	qemu-block@nongnu.org, "David Hildenbrand" <david@redhat.com>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, "Max Reitz" <mreitz@redhat.com>,
	qemu-arm@nongnu.org, "Joel Stanley" <joel@jms.id.au>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [PATCH 1/7] qemu-common: Briefly document qemu_timedate_diff() unit
Date: Mon, 22 Jun 2020 10:50:53 +0200	[thread overview]
Message-ID: <499650b0-63ca-6882-bf63-dd91ffdebdcc@amsat.org> (raw)
In-Reply-To: <87d05xsz6y.fsf@dusky.pond.sub.org>

On 6/18/20 7:47 AM, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> 
>> It is not obvious that the qemu_timedate_diff() and
>> qemu_ref_timedate() functions return seconds. Briefly
>> document it.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  include/qemu-common.h | 1 +
>>  softmmu/vl.c          | 2 +-
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/qemu-common.h b/include/qemu-common.h
>> index d0142f29ac..e97644710c 100644
>> --- a/include/qemu-common.h
>> +++ b/include/qemu-common.h
>> @@ -27,6 +27,7 @@ int qemu_main(int argc, char **argv, char **envp);
>>  #endif
>>  
>>  void qemu_get_timedate(struct tm *tm, int offset);
>> +/* Returns difference with RTC reference time (in seconds) */
>>  int qemu_timedate_diff(struct tm *tm);
> 
> Not this patch's problem: use of int here smells; is it wide enough?

I'll add a /* FIXME */ comment.

> 
>>  
>>  void *qemu_oom_check(void *ptr);
>> diff --git a/softmmu/vl.c b/softmmu/vl.c
>> index f669c06ede..215459c7b5 100644
>> --- a/softmmu/vl.c
>> +++ b/softmmu/vl.c
>> @@ -737,7 +737,7 @@ void qemu_system_vmstop_request(RunState state)
>>  }
>>  
>>  /***********************************************************/
>> -/* RTC reference time/date access */
>> +/* RTC reference time/date access (in seconds) */
>>  static time_t qemu_ref_timedate(QEMUClockType clock)
>>  {
>>      time_t value = qemu_clock_get_ms(clock) / 1000;
> 
> time_t is seconds on all systems we support.  Using it for something
> other than seconds would be wrong.  The comment feels redundant to me.
> But if it helps someone else...

Ah, TIL 'time_t' is the arithmetic time type to represent
the number of seconds since the epoch.

I guess I almost never used it ... (Not something real time
embedded systems care much) :)

So scratch that comment.

> 
> 


  reply	other threads:[~2020-06-22  8:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16  7:51 [PATCH 0/7] misc: Reduce QEMUTimer pressure by using lower precision when possible Philippe Mathieu-Daudé
2020-06-16  7:51 ` [PATCH 1/7] qemu-common: Briefly document qemu_timedate_diff() unit Philippe Mathieu-Daudé
2020-06-18  5:47   ` Markus Armbruster
2020-06-22  8:50     ` Philippe Mathieu-Daudé [this message]
2020-06-16  7:51 ` [PATCH 2/7] block/qcow2: Document cache_clean_interval field holds seconds Philippe Mathieu-Daudé
2020-06-16  7:51 ` [PATCH 3/7] block/curl: Reduce timer precision to milli-second Philippe Mathieu-Daudé
2020-06-16  7:51 ` [PATCH 4/7] hw/virtio/virtio-balloon: Rename timer field including 'ms' unit Philippe Mathieu-Daudé
2020-06-16  7:57   ` David Hildenbrand
2020-06-16  7:51 ` [PATCH 5/7] hw/rtc/m48t59: Reduce timer precision to milli-second Philippe Mathieu-Daudé
2020-07-08 23:39   ` Richard Henderson
2020-06-16  7:51 ` [PATCH 6/7] hw/ipmi/ipmi_bmc_extern: " Philippe Mathieu-Daudé
2020-06-16  7:51 ` [PATCH 7/7] hw/watchdog/wdt_aspeed: Reduce timer precision to micro-second Philippe Mathieu-Daudé
2020-06-17  1:18   ` Andrew Jeffery
2020-06-17  3:41     ` Philippe Mathieu-Daudé
2020-06-22  0:21       ` Andrew Jeffery
2020-06-22  8:43         ` Philippe Mathieu-Daudé
2020-06-22 23:45           ` Andrew Jeffery
2020-07-08 23:40   ` Richard Henderson
2020-06-18 12:23 ` [PATCH 0/7] misc: Reduce QEMUTimer pressure by using lower precision when possible Paolo Bonzini
2020-06-18 12:26   ` Philippe Mathieu-Daudé
2020-06-18 12:42     ` Paolo Bonzini
2020-07-08 23:37 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=499650b0-63ca-6882-bf63-dd91ffdebdcc@amsat.org \
    --to=f4bug@amsat.org \
    --cc=andrew@aj.id.au \
    --cc=armbru@redhat.com \
    --cc=clg@kaod.org \
    --cc=david@redhat.com \
    --cc=joel@jms.id.au \
    --cc=kwolf@redhat.com \
    --cc=minyard@acm.org \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.