static inline unsigned long long timebase() { bgp_time_reg reg; unsigned int utmp; do { utmp = _bgp_mfspr(SPRN_TBRU); reg.ul[1] = _bgp_mfspr(SPRN_TBRL); reg.ul[0] = _bgp_mfspr(SPRN_TBRU); } while( utmp != reg.ul[0] ); return reg.ull; }
double getClock() { union { unsigned int ul[2]; unsigned long long ull; } hack; unsigned int utmp; do { utmp = _bgp_mfspr( SPRN_TBRU ); hack.ul[1] = _bgp_mfspr( SPRN_TBRL ); hack.ul[0] = _bgp_mfspr( SPRN_TBRU ); } while(utmp != hack.ul[0]); return((double) hack.ull ); }
extern inline uint64_t _bgp_GetTimeBase( void ) { union { uint32_t ul[2]; uint64_t ull; } hack; uint32_t utmp; do { utmp = _bgp_mfspr( SPRN_TBRU ); hack.ul[1] = _bgp_mfspr( SPRN_TBRL ); hack.ul[0] = _bgp_mfspr( SPRN_TBRU ); } while( utmp != hack.ul[0] ); return( hack.ull ); }