summaryrefslogtreecommitdiffstats
path: root/contrib/uuid
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2014-04-28 14:18:50 +0000
committerJeff Darcy <jdarcy@redhat.com>2014-04-28 14:18:50 +0000
commite139b4d0ba2286c0d4d44ba81260c2b287016019 (patch)
tree0a21f0761528e0f79da0a9f67106eb128ace0cf7 /contrib/uuid
parent73b60c87ca7f62517a8466431f5a8cf167589c8c (diff)
parentf2bac9f9d5b9956969ddd25a54bc636b82f6923e (diff)
Merge branch 'upstream'HEADmaster
Conflicts: rpc/xdr/src/glusterfs3-xdr.c rpc/xdr/src/glusterfs3-xdr.h xlators/features/changelog/src/Makefile.am xlators/features/changelog/src/changelog-helpers.h xlators/features/changelog/src/changelog.c xlators/mgmt/glusterd/src/glusterd-sm.c Change-Id: I9972a5e6184503477eb77a8b56c50a4db4eec3e2
Diffstat (limited to 'contrib/uuid')
-rw-r--r--contrib/uuid/gen_uuid.c17
-rw-r--r--contrib/uuid/uuid_time.c4
2 files changed, 16 insertions, 5 deletions
diff --git a/contrib/uuid/gen_uuid.c b/contrib/uuid/gen_uuid.c
index b3eda9de3..79923cd54 100644
--- a/contrib/uuid/gen_uuid.c
+++ b/contrib/uuid/gen_uuid.c
@@ -44,6 +44,18 @@
#include <windows.h>
#define UUID MYUUID
#endif
+
+#ifdef __APPLE__
+#define PRI_TIME "ld"
+#define PRI_TIME_USEC "d"
+#define SCAN_TIME "lu"
+#else
+#define PRI_TIME "lu"
+#define PRI_TIME_USEC "lu"
+#define SCAN_TIME "ld"
+#endif
+
+
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -354,8 +366,7 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
unsigned int cl;
unsigned long tv1, tv2;
int a;
-
- if (fscanf(state_f, "clock: %04x tv: %lu %lu adj: %d\n",
+ if (fscanf(state_f, "clock: %04x tv: %" SCAN_TIME " %" SCAN_TIME " adj: %d\n",
&cl, &tv1, &tv2, &a) == 4) {
clock_seq = cl & 0x3FFF;
last.tv_sec = tv1;
@@ -404,7 +415,7 @@ try_again:
if (state_fd > 0) {
rewind(state_f);
len = fprintf(state_f,
- "clock: %04x tv: %016lu %08lu adj: %08d\n",
+ "clock: %04x tv: %016" PRI_TIME "%08" PRI_TIME_USEC "adj: %08d\n",
clock_seq, last.tv_sec, last.tv_usec, adjustment);
fflush(state_f);
if (ftruncate(state_fd, len) < 0) {
diff --git a/contrib/uuid/uuid_time.c b/contrib/uuid/uuid_time.c
index f25f5c90f..ccaa542fe 100644
--- a/contrib/uuid/uuid_time.c
+++ b/contrib/uuid/uuid_time.c
@@ -52,6 +52,7 @@
#include <time.h>
#include "uuidP.h"
+#include "logging.h"
time_t uuid_time(const uuid_t uu, struct timeval *ret_tv)
{
@@ -163,8 +164,7 @@ main(int argc, char **argv)
printf("Warning: not a time-based UUID, so UUID time "
"decoding will likely not work!\n");
}
- printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec,
- ctime(&time_reg));
+ printf("UUID time is: (%" GF_PRI_SECOND ", %" GF_PRI_USEC "): %s\n", tv.tv_sec, tv.tv_usec, ctime(&time_reg));
return 0;
}