ATLAS Offline Software
Loading...
Searching...
No Matches
clock.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id$
12
13#include "CxxUtils/clock.h"
14
15#if defined (__APPLE__) && __clang_major__ < 12
16#include <stdint.h>
17#include <mach/mach_time.h>
18
19long clock_gettime (unsigned int /*which_clock*/, struct timespec *tp)
20{
21 uint64_t time = 0;
22 mach_timebase_info_data_t info;
23 kern_return_t err = mach_timebase_info( &info );
24
25 //Convert the timebase into seconds
26 if( err == 0 ) {
27 uint64_t mach_time = mach_absolute_time( );
28 time = mach_time * info.numer / info.denom;
29 }
30 tp->tv_sec = time * 1e-9;
31 tp->tv_nsec = time - (tp->tv_sec * 1e9);
32 return 0;
33}
34#endif
Provide simplified clock_gettime() function for MacOSX.
time(flags, cells_name, *args, **kw)