From 13566fe3e584e7b14a6f45246976b91677dc2a77 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 8 Jul 2015 15:10:09 +0100 Subject: timer: rename NSEC_PER_SEC due to Mac OS X header clash Commit e0cf11f31c24cfb17f44ed46c254d84c78e7f6e9 ("timer: Use a single definition of NSEC_PER_SEC for the whole codebase") renamed NANOSECONDS_PER_SECOND to NSEC_PER_SEC. On Mac OS X there is a system header which also defines NSEC_PER_SEC. This causes compiler warnings. Let's use the old name instead. It's longer but it doesn't clash. Signed-off-by: Stefan Hajnoczi Message-id: 1436364609-7929-1-git-send-email-stefanha@redhat.com Signed-off-by: Peter Maydell --- hw/ppc/ppc.c | 5 +++-- hw/ppc/spapr_rtc.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'hw/ppc') diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 2a4b8e1..b77e303 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -873,8 +873,9 @@ static int timebase_post_load(void *opaque, int version_id) */ host_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST); ns_diff = MAX(0, host_ns - tb_remote->time_of_the_day_ns); - migration_duration_ns = MIN(NSEC_PER_SEC, ns_diff); - migration_duration_tb = muldiv64(migration_duration_ns, freq, NSEC_PER_SEC); + migration_duration_ns = MIN(NANOSECONDS_PER_SECOND, ns_diff); + migration_duration_tb = muldiv64(migration_duration_ns, freq, + NANOSECONDS_PER_SECOND); guest_tb = tb_remote->guest_timebase + MIN(0, migration_duration_tb); tb_off_adj = guest_tb - cpu_get_real_ticks(); diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c index d20b8f2..34b27db 100644 --- a/hw/ppc/spapr_rtc.c +++ b/hw/ppc/spapr_rtc.c @@ -51,7 +51,7 @@ void spapr_rtc_read(DeviceState *dev, struct tm *tm, uint32_t *ns) assert(rtc); guest_ns = host_ns + rtc->ns_offset; - guest_s = guest_ns / NSEC_PER_SEC; + guest_s = guest_ns / NANOSECONDS_PER_SECOND; if (tm) { gmtime_r(&guest_s, tm); @@ -71,7 +71,7 @@ int spapr_rtc_import_offset(DeviceState *dev, int64_t legacy_offset) rtc = SPAPR_RTC(dev); - rtc->ns_offset = legacy_offset * NSEC_PER_SEC; + rtc->ns_offset = legacy_offset * NANOSECONDS_PER_SECOND; return 0; } @@ -146,7 +146,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, sPAPRMachineState *spapr, host_ns = qemu_clock_get_ns(rtc_clock); - rtc->ns_offset = (new_s * NSEC_PER_SEC) - host_ns; + rtc->ns_offset = (new_s * NANOSECONDS_PER_SECOND) - host_ns; rtas_st(rets, 0, RTAS_OUT_SUCCESS); } @@ -168,7 +168,7 @@ static void spapr_rtc_realize(DeviceState *dev, Error **errp) qemu_get_timedate(&tm, 0); host_s = mktimegm(&tm); rtc_ns = qemu_clock_get_ns(rtc_clock); - rtc->ns_offset = host_s * NSEC_PER_SEC - rtc_ns; + rtc->ns_offset = host_s * NANOSECONDS_PER_SECOND - rtc_ns; object_property_add_tm(OBJECT(rtc), "date", spapr_rtc_qom_date, NULL); } -- cgit v1.1