ATLAS Offline Software
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$
13 #include "CxxUtils/clock.h"
14 
15 #if defined (__APPLE__) && __clang_major__ < 12
16 #include <stdint.h>
17 #include <mach/mach_time.h>
18 
19 long 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
grepfile.info
info
Definition: grepfile.py:38
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
ParticleTest.tp
tp
Definition: ParticleTest.py:25
clock.h
Provide simplified clock_gettime() function for MacOSX.
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
PerfMon::clock_gettime
struct timespec clock_gettime()
Definition: PerfMonEventDict.h:18
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242