GRU - Generic Reusable Utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
gru_time_portable.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Otavio Piske <angusyoung@gmail.com>.
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 
21 #ifndef GRU_TIME_PORTABLE_H
22 #define GRU_TIME_PORTABLE_H
23 
24 #if !defined(_WIN32) && !defined(_WIN64)
25 #include <sys/time.h>
26 #else
27 #include <windows.h>
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #if !defined __linux__ && !defined timersub
35 int gru_time_timersub(struct timeval *start, struct timeval *end, struct timeval *result);
36 
37 #define timersub(start, end, result) gru_time_timersub(start, end, result)
38 #endif
39 
40 #ifdef __cplusplus
41 }
42 #endif
43 
44 #endif /* GRU_TIME_PORTABLE_H */
int gru_time_timersub(struct timeval *start, struct timeval *end, struct timeval *result)
Portable, non-Linux, time utilities.