On Fri, May 23, 2014 at 11:36:56PM +0200, Paolo Bonzini wrote:
You can get the current time via the qom-get command, and then
follow the same algorithm as QEMU:
time_t seconds;
if (rtc_date_offset == -1) {
if (rtc_utc) {
seconds = mktimegm(tm);
} else {
struct tm tmp = *tm;
tmp.tm_isdst = -1; /* use timezone to figure it out */
seconds = mktime(&tmp);
}
} else {
seconds = mktimegm(tm) + rtc_date_offset;
}
return seconds - time(NULL);
Unfortunately the QOM path to the RTC device is not stable. We can
add a /machine/rtc link, and if the PPC guys implement the link and
current-time property as well, the same mechanism can work for any
board.
Paolo
I like that idea. Questions:
- What guarantees are there that the interface is stable?
(you can argue that "now it is").
- Perhaps add /machine/stable/ path to contain stable
links ?
- How do i go about adding a link to a device again?