Truxton time now

From truxwiki.com
Jump to navigation Jump to search

This will give you the current time in a format required by the rest of the API.

Syntax

uint64_t truxton_time_now( void );

Return value

The current time as FILETIME ticks.

Sample

void test_time( void )
{
   uint64_t ticks = truxton_time_now();

   printf( "The time is now %" PRIu64 "\n" );
}

The PRIu64 in the sample code above is a standard way of formatting a 64-bit unsigned integer in C. Over the years, different compilers on different operating systems used different format specifiers for things, these PRI macros, along with some tricky string concatenation the compilers perform for you, allow you to maintain a single code base without a bunch of macro magic.