From cded0c80b0cc4e32475f3f78ef39b23751a8f06b Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Fri, 13 May 2011 07:07:13 +0200 Subject: [PATCH] time_t is not a long on FreeBSD, switch internal type to long long --- 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 +- tests/esxutilstest.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3f2fb1103c..8ff155b831 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 9d4349e480..d4245d8cca 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 c689ab0e0a..2332fde8d6 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 d141a38103..3d843bff9f 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 2b365358fb..51c1e34979 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; -- GitLab