--- libelwix/src/time.c 2013/06/19 00:11:16 1.3 +++ libelwix/src/time.c 2022/12/01 19:50:46 1.5.72.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: time.c,v 1.3 2013/06/19 00:11:16 misho Exp $ +* $Id: time.c,v 1.5.72.1 2022/12/01 19:50:46 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 +Copyright 2004 - 2022 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -283,12 +283,15 @@ time_rdtsc(void) asm volatile("rdtsc" : "=a" (res)); return res; -#elif +#else /* unsupported for this architecture, get time by ordinary way */ struct timespec ts = { 0, 0LL }; - uint64_t res; +#ifndef CLOCK_UPTIME_PRECISE + clock_gettime(CLOCK_MONOTONIC, &ts); +#else clock_gettime(CLOCK_UPTIME_PRECISE, &ts); +#endif return ((uint64_t) ts.tv_sec * 1000000000 + ts.tv_nsec); #endif }