xref: /haiku/src/system/libroot/posix/time/timespec_get.cpp (revision 344ded80d400028c8f561b4b876257b94c12db4a)
1 /*
2  * Copyright 2022, Jérôme Duval, jerome.duval@gmail.com.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <time.h>
8 
9 #include <OS.h>
10 #include <SupportDefs.h>
11 
12 #include <time_private.h>
13 
14 
15 int
16 timespec_get(struct timespec* time, int base)
17 {
18 	if (base != TIME_UTC)
19 		return 0;
20 
21 	bigtime_t microSeconds = real_time_clock_usecs();
22 	bigtime_to_timespec(microSeconds, *time);
23 	return base;
24 }
25