summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
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 @@
28#ifndef __struct_log_time_defined 28#ifndef __struct_log_time_defined
29#define __struct_log_time_defined 29#define __struct_log_time_defined
30 30
31#define LOG_TIME_SEC(t) ((t)->tv_sec)
32/* next power of two after NS_PER_SEC */
33#define LOG_TIME_NSEC(t) ((t)->tv_nsec & (UINT32_MAX >> 2))
34
31#ifdef __cplusplus 35#ifdef __cplusplus
32 36
33/* 37/*
@@ -167,15 +171,15 @@ struct log_time {
167#endif 171#endif
168} __attribute__((__packed__)); 172} __attribute__((__packed__));
169 173
170#else 174#else /* __cplusplus */
171 175
172typedef struct log_time { 176typedef struct log_time {
173 uint32_t tv_sec; 177 uint32_t tv_sec;
174 uint32_t tv_nsec; 178 uint32_t tv_nsec;
175} __attribute__((__packed__)) log_time; 179} __attribute__((__packed__)) log_time;
176 180
177#endif 181#endif /* __cplusplus */
178 182
179#endif 183#endif /* __struct_log_time_defined */
180 184
181#endif /* _LIBS_LOG_LOG_TIME_H */ 185#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 @@
1../../include/log/log_time.h \ No newline at end of file 1/*
2 * Copyright (C) 2005-2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _LIBS_LOG_LOG_TIME_H
18#define _LIBS_LOG_LOG_TIME_H
19
20#include <stdint.h>
21
22/* struct log_time is a wire-format variant of struct timespec */
23#ifndef NS_PER_SEC
24#define NS_PER_SEC 1000000000ULL
25#endif
26#ifndef US_PER_SEC
27#define US_PER_SEC 1000000ULL
28#endif
29#ifndef MS_PER_SEC
30#define MS_PER_SEC 1000ULL
31#endif
32
33#ifndef __struct_log_time_defined
34#define __struct_log_time_defined
35
36#define LOG_TIME_SEC(t) ((t)->tv_sec)
37/* next power of two after NS_PER_SEC */
38#define LOG_TIME_NSEC(t) ((t)->tv_nsec & (UINT32_MAX >> 2))
39
40typedef struct log_time {
41 uint32_t tv_sec;
42 uint32_t tv_nsec;
43} __attribute__((__packed__)) log_time;
44
45#endif
46
47#endif /* _LIBS_LOG_LOG_TIME_H */