[dpdk-dev] [PATCH 1/6] eal: add internal API for current time

Nick Connolly nick.connolly at mayadata.io
Mon Mar 1 23:31:34 CET 2021


Calculation of usec value is incorrect - 'ticks' is not adjusted for 
epoch, whereas 'sec' has been, also subtraction has mismatched units - 
ticks in 100ns and sec * USEC_PER_SEC in usecs.


On 14/02/2021 01:20, Dmitry Kozlyuk wrote:
> +	GetSystemTimePreciseAsFileTime(&ft);
> +	ticks = ((uint64_t)ft.dwHighDateTime << 32) | ft.dwLowDateTime;
> +	sec = (ticks - EPOCH) / (TICKS_PER_USEC * USEC_PER_SEC);
> +	now->sec = sec;
> +	now->usec = (ticks - sec * USEC_PER_SEC) / TICKS_PER_USEC;



More information about the dev mailing list