#include <iostream>
#include <sys/time.h>
#include <stdint.h>
void convert(uint64_t offset )
{
struct timeval t;
t.tv_sec = offset / 1000000;
std::cout << "currentTimeOffset " << offset << "startTimeOffset " << t.tv_sec << std::endl;
t.tv_usec = offset % 1000000;
std::cout << "stattime usec " << t.tv_usec << std::endl ;
}
int main(int argc , char** argv)
{
uint64_t t = 18446744073709551615;
convert(t );
return 0;
}
丸め誤差はありますか? どうすればこれを達成できますか?これは、コードが変換されている他の場所から呼び出されるルーチンです。uint64_t
私は負の数を与えているの例で小さなスクリプトを書きました