[XEN] localtime support for paravirtualized guests

It is quite minimal
in its approach, satisfying the purposes of the paravirtualized
NetWare operating system as well as any others that expect the time
base to be provided in localtime.

Signed-off-by: Bruce Rogers <brogers@novell.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2006-06-21 17:09:14 +01:00
1 parent 060b6f6d38
commit 42fae7ae02
9 files changed
+79 -1

No files matched your search

+31
View File
@@ -869,6 +869,30 @@ static PyObject *pyxc_domain_iomem_permission(PyObject *self,
return zero;
}
static PyObject *pyxc_domain_set_time_offset(XcObject *self, PyObject *args)
{
uint32_t dom;
int32_t time_offset_seconds;
time_t calendar_time;
struct tm local_time;
struct tm utc_time;
if (!PyArg_ParseTuple(args, "i", &dom))
return NULL;
calendar_time = time(NULL);
localtime_r(&calendar_time, &local_time);
gmtime_r(&calendar_time, &utc_time);
/* set up to get calendar time based on utc_time, with local dst setting */
utc_time.tm_isdst = local_time.tm_isdst;
time_offset_seconds = (int32_t)difftime(calendar_time, mktime(&utc_time));
if (xc_domain_set_time_offset(self->xc_handle, dom, time_offset_seconds) != 0)
return NULL;
Py_INCREF(zero);
return zero;
}
static PyObject *dom_op(XcObject *self, PyObject *args,
int (*fn)(int, uint32_t))
@@ -1208,6 +1232,13 @@ static PyMethodDef pyxc_methods[] = {
"Returns: [int]: The size in KiB of memory spanning the given number "
"of pages.\n" },
{ "domain_set_time_offset",
(PyCFunction)pyxc_domain_set_time_offset,
METH_VARARGS, "\n"
"Set a domain's time offset to Dom0's localtime\n"
" dom [int]: Domain whose time offset is being set.\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ NULL, NULL, 0, NULL }
};
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.