summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorJayant Chowdhary <jchowdhary@google.com>2017-10-03 20:01:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-10-03 20:01:13 +0000
commit541428a13b8976b58893d6427c94b36084514546 (patch)
tree15f997a80a3d03337c97bee8326a6ad38179e758 /liblog
parent7b3d4da91a064ddc0973b1c03c1d6c68b76b9952 (diff)
parent0d047642ebde013ed44ec6386a20debd87e54eb9 (diff)
downloadcore-541428a13b8976b58893d6427c94b36084514546.tar.gz
core-541428a13b8976b58893d6427c94b36084514546.tar.bz2
core-541428a13b8976b58893d6427c94b36084514546.zip
Merge "Hide implementation details of log_time struct"
Diffstat (limited to 'liblog')
-rw-r--r--liblog/include/log/log_time.h10
-rw-r--r--[l---------]liblog/include_vndk/log/log_time.h48
2 files changed, 54 insertions, 4 deletions
diff --git a/liblog/include/log/log_time.h b/liblog/include/log/log_time.h
index 3764faf75..309f5d12f 100644
--- a/liblog/include/log/log_time.h
+++ b/liblog/include/log/log_time.h
@@ -28,6 +28,10 @@
#ifndef __struct_log_time_defined
#define __struct_log_time_defined
+#define LOG_TIME_SEC(t) ((t)->tv_sec)
+/* next power of two after NS_PER_SEC */
+#define LOG_TIME_NSEC(t) ((t)->tv_nsec & (UINT32_MAX >> 2))
+
#ifdef __cplusplus
/*
@@ -167,15 +171,15 @@ struct log_time {
#endif
} __attribute__((__packed__));
-#else
+#else /* __cplusplus */
typedef struct log_time {
uint32_t tv_sec;
uint32_t tv_nsec;
} __attribute__((__packed__)) log_time;
-#endif
+#endif /* __cplusplus */
-#endif
+#endif /* __struct_log_time_defined */
#endif /* _LIBS_LOG_LOG_TIME_H */
diff --git a/liblog/include_vndk/log/log_time.h b/liblog/include_vndk/log/log_time.h
index abfe439ae..5a09959a7 120000..100644
--- a/liblog/include_vndk/log/log_time.h
+++ b/liblog/include_vndk/log/log_time.h
@@ -1 +1,47 @@
-../../include/log/log_time.h \ No newline at end of file
+/*
+ * Copyright (C) 2005-2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LIBS_LOG_LOG_TIME_H
+#define _LIBS_LOG_LOG_TIME_H
+
+#include <stdint.h>
+
+/* struct log_time is a wire-format variant of struct timespec */
+#ifndef NS_PER_SEC
+#define NS_PER_SEC 1000000000ULL
+#endif
+#ifndef US_PER_SEC
+#define US_PER_SEC 1000000ULL
+#endif
+#ifndef MS_PER_SEC
+#define MS_PER_SEC 1000ULL
+#endif
+
+#ifndef __struct_log_time_defined
+#define __struct_log_time_defined
+
+#define LOG_TIME_SEC(t) ((t)->tv_sec)
+/* next power of two after NS_PER_SEC */
+#define LOG_TIME_NSEC(t) ((t)->tv_nsec & (UINT32_MAX >> 2))
+
+typedef struct log_time {
+ uint32_t tv_sec;
+ uint32_t tv_nsec;
+} __attribute__((__packed__)) log_time;
+
+#endif
+
+#endif /* _LIBS_LOG_LOG_TIME_H */