if (n + 8 > l)
return NULL; /* Microseconds part doesn't fit. */
- sprintf(buf + n, ".%06llu", (unsigned long long) (t % USEC_PER_SEC));
+ sprintf(buf + n, ".%06"PRI_USEC, t % USEC_PER_SEC);
}
/* Append the timezone */
if (j > 0) {
k = snprintf(p, l,
- "%s"USEC_FMT".%0*llu%s",
+ "%s"USEC_FMT".%0*"PRI_USEC"%s",
p > buf ? " " : "",
a,
j,
- (unsigned long long) b,
+ b,
table[i].suffix);
t = 0;
r = sysconf(_SC_CLK_TCK);
assert(r > 0);
- hz = (unsigned long) r;
+ hz = r;
}
return DIV_ROUND_UP(u , USEC_PER_SEC / hz);
typedef uint64_t usec_t;
typedef uint64_t nsec_t;
-#define NSEC_FMT "%" PRIu64
-#define USEC_FMT "%" PRIu64
+#define PRI_NSEC PRIu64
+#define PRI_USEC PRIu64
+#define NSEC_FMT "%" PRI_NSEC
+#define USEC_FMT "%" PRI_USEC
#include "macro.h"
"Documentation=man:systemd-gpt-auto-generator(8)\n"
"[Automount]\n"
"Where=%s\n"
- "TimeoutIdleSec=%lld\n",
+ "TimeoutIdleSec="USEC_FMT"\n",
description,
where,
- (unsigned long long)timeout / USEC_PER_SEC);
+ timeout / USEC_PER_SEC);
r = fflush_and_check(f);
if (r < 0)
if (r < 0)
return log_error_errno(r, "Failed to get monotonic timestamp: %m");
- fprintf(f, "[%5llu.%06llu]",
- (unsigned long long) (t / USEC_PER_SEC),
- (unsigned long long) (t % USEC_PER_SEC));
-
+ fprintf(f, "[%5"PRI_USEC".%06"PRI_USEC"]", t / USEC_PER_SEC, t % USEC_PER_SEC);
return 1 + 5 + 1 + 6 + 1;
}
switch (mode) {
case OUTPUT_SHORT_UNIX:
- xsprintf(buf, "%10llu.%06llu", (unsigned long long) t, (unsigned long long) (x % USEC_PER_SEC));
+ xsprintf(buf, "%10"PRI_TIME".%06"PRIu64, t, x % USEC_PER_SEC);
break;
case OUTPUT_SHORT_ISO:
assert(sizeof(buf) > strlen(buf));
k = sizeof(buf) - strlen(buf);
- r = snprintf(buf + strlen(buf), k, ".%06llu", (unsigned long long) (x % USEC_PER_SEC));
+ r = snprintf(buf + strlen(buf), k, ".%06"PRIu64, x % USEC_PER_SEC);
if (r <= 0 || (size_t) r >= k) { /* too long? */
log_error("Failed to format precise time");
return -EINVAL;
m->drift_ppm = tmx.freq / 65536;
log_debug(" status : %04i %s\n"
- " time now : %li.%03llu\n"
+ " time now : %li.%03"PRI_USEC"\n"
" constant : %li\n"
" offset : %+.3f sec\n"
" freq offset : %+li (%i ppm)\n",
tmx.status, tmx.status & STA_UNSYNC ? "unsync" : "sync",
- tmx.time.tv_sec, (unsigned long long) (tmx.time.tv_usec / NSEC_PER_MSEC),
+ tmx.time.tv_sec, tmx.time.tv_usec / NSEC_PER_MSEC,
tmx.constant,
(double)tmx.offset / NSEC_PER_SEC,
tmx.freq, m->drift_ppm);