[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Patch] [kinda-resend] persistent real-time-clock
From: |
Dan Kenigsberg |
Subject: |
Re: [Qemu-devel] [Patch] [kinda-resend] persistent real-time-clock |
Date: |
Mon, 28 Apr 2008 10:27:32 +0300 |
User-agent: |
Mutt/1.5.17 (2007-11-01) |
On Sun, Apr 27, 2008 at 10:28:03PM +0100, Jamie Lokier wrote:
> Dan Kenigsberg wrote:
> > These patches will allow doing the same with VM:
> > - Before shutting a VM down, use the monitor's info timeoffset to see
> > how much (in seconds) does the rtc differ from the host clock.
> > - Store this offset somewhere.
> > - Use it next time with -startdate now+offset.
>
> Another useful one would be store the actual time, and use the same
> time when starting next time - without including any advance in host's
> clock in the interval.
>
> That's useful when running some time-limited software in a VM. Then
> you can only run the VM when you're using the software, and get more
> use out of it before the time runs out.
>
It does not seem hard to add something like that (though it seems quite
orthogonal to my original perpose). Did you mean something like the
following?
diff --git a/monitor.c b/monitor.c
index 76817e1..45396aa 100644
--- a/monitor.c
+++ b/monitor.c
@@ -264,6 +264,14 @@ static void do_info_blockstats(void)
bdrv_info_stats();
}
+void do_info_timedate(void)
+{
+ struct tm tm;
+ qemu_get_timedate(&tm, 0);
+ term_printf("%d-%02d-%02dT%02d:%02d:%02d\n", tm.tm_year + 1900, tm.tm_mon,
+ tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+}
+
/* get the current CPU defined by the user */
static int mon_set_cpu(int cpu_index)
{
@@ -1410,6 +1418,8 @@ static term_cmd_t info_cmds[] = {
{ "timeoffset", "", do_info_timeoffset,
"", "show how much the VM real time clock differ from host time" },
#endif
+ { "timedate", "", do_info_timedate,
+ "", "show the current VM time and date" },
{ "name", "", do_info_name,
"", "show the current VM name" },
#if defined(TARGET_PPC)