Subversion Repositories Kolibri OS

Rev

Rev 3770 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3770 Rev 3772
Line 26... Line 26...
26
 **************************************************************************/
26
 **************************************************************************/
Line 27... Line 27...
27
 
27
 
28
/**
28
/**
29
 * @file
29
 * @file
30
 * OS independent time-manipulation functions.
30
 * OS independent time-manipulation functions.
31
 * 
31
 *
32
 * @author Jose Fonseca 
32
 * @author Jose Fonseca 
Line 33... Line 33...
33
 */
33
 */
Line 34... Line -...
34
 
-
 
35
 
34
 
36
#include "pipe/p_config.h"
35
 
37
 
-
 
38
#if defined(PIPE_OS_UNIX)
-
 
39
#  include  /* timeval */
-
 
40
#  include  /* timeval */
-
 
41
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-
 
Line 42... Line 36...
42
#  include 
36
#include "pipe/p_config.h"
Line 43... Line 37...
43
#else
37
 
44
#  error Unsupported OS
38
#  include  /* timeval */
45
#endif
39
#  include  /* timeval */
46
 
-
 
47
#include "os_time.h"
-
 
48
 
-
 
49
 
-
 
50
int64_t
-
 
51
os_time_get_nano(void)
-
 
52
{
-
 
53
#if defined(PIPE_OS_LINUX)
-
 
54
 
40
 
55
   struct timespec tv;
41
#include "os_time.h"
56
   clock_gettime(CLOCK_MONOTONIC, &tv);
-
 
57
   return tv.tv_nsec + tv.tv_sec*INT64_C(1000000000);
-
 
58
 
-
 
59
#elif defined(PIPE_OS_UNIX)
-
 
60
 
-
 
61
   struct timeval tv;
-
 
62
   gettimeofday(&tv, NULL);
-
 
63
   return tv.tv_usec*INT64_C(1000) + tv.tv_sec*INT64_C(1000000000);
-
 
64
 
-
 
65
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
-
 
66
 
-
 
67
   static LARGE_INTEGER frequency;
-
 
68
   LARGE_INTEGER counter;
-
 
69
   if(!frequency.QuadPart)
-
 
70
      QueryPerformanceFrequency(&frequency);
-
 
71
   QueryPerformanceCounter(&counter);
-
 
72
   return counter.QuadPart*INT64_C(1000000000)/frequency.QuadPart;
42
 
Line 73... Line 43...
73
 
43