| 1 |
// Copyright (c) Microsoft. All rights reserved. |
| 2 |
// Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| 3 |
|
| 4 |
#ifndef LINUX_TIME_H |
| 5 |
#define LINUX_TIME_H |
| 6 |
|
| 7 |
#include <stdint.h> |
| 8 |
#include <time.h> |
| 9 |
#include <pthread.h> |
| 10 |
|
| 11 |
#ifndef __MACH__ |
| 12 |
extern clockid_t time_basis; |
| 13 |
#endif |
| 14 |
|
| 15 |
extern void set_time_basis(void); |
| 16 |
extern int get_time_ns(struct timespec* ts); |
| 17 |
extern int64_t get_time_ms(void); |
| 18 |
|
| 19 |
#define INVALID_TIME_VALUE (int64_t)(-1) |
| 20 |
|
| 21 |
|
| 22 |
#define NANOSECONDS_IN_1_SECOND 1000000000L |
| 23 |
#define MILLISECONDS_IN_1_SECOND 1000 |
| 24 |
#define NANOSECONDS_IN_1_MILLISECOND 1000000L |
| 25 |
|
| 26 |
#endif |
| 27 |
|