summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 45e631c)
raw | patch | inline | side by side (parent: 45e631c)
author | Florian Forster <octo@collectd.org> | |
Fri, 21 Aug 2015 10:49:04 +0000 (12:49 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 21 Aug 2015 10:49:04 +0000 (12:49 +0200) |
The CDTIME_T_TO_TIME_T() macro used to cast its input to time_t, which is
a 32bit type on (some?) 32bit architectures.
This is a regression introduced in db1391aaa66b8b8fad82219494f61f3452441f62
and not found in any released version of collectd. Phew!
a 32bit type on (some?) 32bit architectures.
This is a regression introduced in db1391aaa66b8b8fad82219494f61f3452441f62
and not found in any released version of collectd. Phew!
src/daemon/utils_time.h | patch | blob | history |
index 6476780ad4f4e9cde02eeaf3044e39d7548de4cc..2cc84b5dec4013eb00a720e0132280cafd00aa2a 100644 (file)
--- a/src/daemon/utils_time.h
+++ b/src/daemon/utils_time.h
/**
- * collectd - src/utils_time.h
- * Copyright (C) 2010 Florian octo Forster
+ * collectd - src/daemon/utils_time.h
+ * Copyright (C) 2010-2015 Florian octo Forster
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Florian octo Forster <ff at octo.it>
+ * Florian octo Forster <octo at collectd.org>
**/
#ifndef UTILS_TIME_H
#define NS_TO_CDTIME_T(ns) (((((cdtime_t) (ns)) / 1000000000) << 30) | \
((((((cdtime_t) (ns)) % 1000000000) << 30) + 500000000) / 1000000000))
-#define CDTIME_T_TO_TIME_T(t) ((((time_t) (t)) + (1 << 29)) >> 30)
-#define CDTIME_T_TO_MS(t) (((((uint64_t) (t)) >> 30) * 1000L) + \
- (((((uint64_t) (t)) & 0x3fffffff) * 1000L + (1 << 29)) >> 30))
-#define CDTIME_T_TO_US(t) (((((uint64_t) (t)) >> 30) * 1000000L) + \
- (((((uint64_t) (t)) & 0x3fffffff) * 1000000L + (1 << 29)) >> 30))
-#define CDTIME_T_TO_NS(t) (((((uint64_t) (t)) >> 30) * 1000000000L) + \
- (((((uint64_t) (t)) & 0x3fffffff) * 1000000000L + (1 << 29)) >> 30))
+#define CDTIME_T_TO_TIME_T(t) ((time_t) (((t) + (1 << 29)) >> 30))
+#define CDTIME_T_TO_MS(t) ((uint64_t) ((((t) >> 30) * 1000) + \
+ ((((t) & 0x3fffffff) * 1000 + (1 << 29)) >> 30)))
+#define CDTIME_T_TO_US(t) ((uint64_t) ((((t) >> 30) * 1000000) + \
+ ((((t) & 0x3fffffff) * 1000000 + (1 << 29)) >> 30)))
+#define CDTIME_T_TO_NS(t) ((uint64_t) ((((t) >> 30) * 1000000000) + \
+ ((((t) & 0x3fffffff) * 1000000000 + (1 << 29)) >> 30)))
#define CDTIME_T_TO_DOUBLE(t) (((double) (t)) / 1073741824.0)
#define DOUBLE_TO_CDTIME_T(d) ((cdtime_t) ((d) * 1073741824.0))