On Wed, Apr 25, 2018 at 12:20:16PM +0200, Katerina Koukiou wrote:
Signed-off-by: Katerina Koukiou <kkoukiou(a)redhat.com>
---
data/org.libvirt.Domain.xml | 6 ++++++
src/domain.c | 28 ++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml
index a57b05a..631dabb 100644
--- a/data/org.libvirt.Domain.xml
+++ b/data/org.libvirt.Domain.xml
@@ -201,6 +201,12 @@
<arg name="flags" type="u" direction="in"/>
<arg name="records" type="a{sv}"
direction="out"/>
</method>
+ <method name="GetTime">
+ <annotation name="org.gtk.GDBus.DocString"
+ value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetTime&quo...
+ <arg name="flags" type="u" direction="in"/>
+ <arg name="time" type="(tu)" direction="out"/>
+ </method>
<method name="GetVcpus">
<annotation name="org.gtk.GDBus.DocString"
value="See
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFla...
diff --git a/src/domain.c b/src/domain.c
index 488760b..f6de3ac 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -1054,6 +1054,33 @@ virtDBusDomainGetStats(GVariant *inArgs,
*outArgs = g_variant_new_tuple(&grecords, 1);
}
+static void
+virtDBusDomainGetTime(GVariant *inArgs,
+ GUnixFDList *inFDs G_GNUC_UNUSED,
+ const gchar *objectPath,
+ gpointer userData,
+ GVariant **outArgs,
+ GUnixFDList **outFDs G_GNUC_UNUSED,
+ GError **error)
+{
+ virtDBusConnect *connect = userData;
+ g_autoptr(virDomain) domain = NULL;
+ glong seconds;
Per
https://developer.gnome.org/glib/2.56/glib-Basic-Types.html#glong
This is the equivalent of C's long type.
For 'long long', gint64 should be used.
Unless nobody cares about 32-bit architectures anymore,
then
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano
+ guint nseconds;
+ guint flags;
+
+ g_variant_get(inArgs, "(u)", &flags);
+
+ domain = virtDBusDomainGetVirDomain(connect, objectPath, error);
+ if (!domain)
+ return;
+
+ if (virDomainGetTime(domain, (long long *)&seconds, &nseconds, flags) <
0)
+ return virtDBusUtilSetLastVirtError(error);
+
+ *outArgs = g_variant_new("((tu))", seconds, nseconds);
+}
+
static void
virtDBusDomainGetVcpus(GVariant *inArgs,
GUnixFDList *inFDs G_GNUC_UNUSED,