[PATCH v2] time_t is not a long on FreeBSD, switch internal type to long long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
v2: switch internal type to long long instead of adding casts for time_t

 src/conf/domain_conf.c |    8 ++++----
 src/conf/domain_conf.h |    2 +-
 src/esx/esx_vi_types.c |    2 +-
 src/esx/esx_vi_types.h |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3f2fb11..8ff155b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9183,7 +9183,7 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr,
 
     def->name = virXPathString("string(./name)", ctxt);
     if (def->name == NULL)
-        ignore_value(virAsprintf(&def->name, "%ld", tv.tv_sec));
+        ignore_value(virAsprintf(&def->name, "%lld", (long long)tv.tv_sec));
 
     if (def->name == NULL) {
         virReportOOMError();
@@ -9193,8 +9193,8 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr,
     def->description = virXPathString("string(./description)", ctxt);
 
     if (!newSnapshot) {
-        if (virXPathLong("string(./creationTime)", ctxt,
-                         &def->creationTime) < 0) {
+        if (virXPathLongLong("string(./creationTime)", ctxt,
+                             &def->creationTime) < 0) {
             virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                  _("missing creationTime from existing snapshot"));
             goto cleanup;
@@ -9259,7 +9259,7 @@ char *virDomainSnapshotDefFormat(char *domain_uuid,
         virBufferAsprintf(&buf, "    <name>%s</name>\n", def->parent);
         virBufferAddLit(&buf, "  </parent>\n");
     }
-    virBufferAsprintf(&buf, "  <creationTime>%ld</creationTime>\n",
+    virBufferAsprintf(&buf, "  <creationTime>%lld</creationTime>\n",
                       def->creationTime);
     virBufferAddLit(&buf, "  <domain>\n");
     virBufferAsprintf(&buf, "    <uuid>%s</uuid>\n", domain_uuid);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9d4349e..d4245d8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1042,7 +1042,7 @@ struct _virDomainSnapshotDef {
     char *name;
     char *description;
     char *parent;
-    time_t creationTime;
+    long long creationTime; /* in seconds */
     int state;
 
     long active;
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index c689ab0..2332fde 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -1402,7 +1402,7 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
 
 int
 esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
-                                     time_t *secondsSinceEpoch)
+                                     long long *secondsSinceEpoch)
 {
     char value[64] = "";
     char *tmp;
diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h
index d141a38..3d843bf 100644
--- a/src/esx/esx_vi_types.h
+++ b/src/esx/esx_vi_types.h
@@ -264,7 +264,7 @@ int esxVI_DateTime_Serialize(esxVI_DateTime *dateTime, const char *element,
                              virBufferPtr output);
 int esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime);
 int esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
-                                         time_t *secondsSinceEpoch);
+                                         long long *secondsSinceEpoch);
 
 
 
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]