modularized time function, use high resolution timer if available