diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3f2fb1103c7f8a4973b1e0c10c3904d2a4e5b504..8ff155b831eeee96959d44f0a01715543f8134f4 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, " %s\n", def->parent);
virBufferAddLit(&buf, " \n");
}
- virBufferAsprintf(&buf, " %ld\n",
+ virBufferAsprintf(&buf, " %lld\n",
def->creationTime);
virBufferAddLit(&buf, " \n");
virBufferAsprintf(&buf, " %s\n", domain_uuid);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9d4349e480679766e0b3ded07d096e3a9445cc91..d4245d8cca41dc0952e4cc29a4af53ca04eaf22f 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 c689ab0e0aa9345e66655380c6a4afa21fe2b74d..2332fde8d62175c2cadb09841ca1ea854b2eea09 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 d141a3810300efa1198a7d1f79b5adaa8fa38a12..3d843bff9f80b5d14fc2373d9889a962fd97f6d2 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);
diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c
index 2b365358fb656f21e7e47dcc9120181b0bc5767c..51c1e3497936746029d351919fa94cde07d05f10 100644
--- a/tests/esxutilstest.c
+++ b/tests/esxutilstest.c
@@ -169,7 +169,7 @@ testParseDatastorePath(const void *data ATTRIBUTE_UNUSED)
struct testDateTime {
const char *dateTime;
- time_t calendarTime;
+ long long calendarTime;
};
static struct testDateTime times[] = {
@@ -205,7 +205,7 @@ testConvertDateTimeToCalendarTime(const void *data ATTRIBUTE_UNUSED)
{
int i;
esxVI_DateTime dateTime;
- time_t calendarTime;
+ long long calendarTime;
for (i = 0; i < ARRAY_CARDINALITY(times); ++i) {
dateTime.value = (char *)times[i].dateTime;