Merge changes from topic "hide_log_time" into oc-mr1-dev

* changes:
  Hide implementation details of log_time struct
  Don't rely on transitively included headers
This commit is contained in:
TreeHugger Robot 2017-09-07 02:39:39 +00:00 committed by Android (Google) Code Review
commit cd00582000
3 changed files with 55 additions and 5 deletions

View file

@ -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 */

View file

@ -1 +0,0 @@
../../include/log/log_time.h

View file

@ -0,0 +1,47 @@
/*
* 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 */

View file

@ -23,9 +23,9 @@
#include <utils/SystemClock.h>
#include <sys/time.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <cutils/compiler.h>