c++ interface timestamp converstion

Can someone share sample code to convert timeval structure in C to KDB timestamp.

There are samples to get individual components from KDB timestamp in C but not the other way round.

As per the documentation, it mentions to use the pu function but the input to the function is not mentioned. :(

If someone can elaborate the below line from 

http://code.kx.com/wiki/Cookbook/InterfacingWithC

J pu(I u){return 8.64e13*(u/8.64e4-10957);} // kdb+ timestamp from unix, use ktj(Kj,n) to create timestamp from n

checkout http://code.kx.com/wiki/Cookbook/ExtendingWithC#High_Precision_wall_time_on_Linux