Skip to content

Instantly share code, notes, and snippets.

@focs
focs / utils.cpp
Last active December 20, 2016 17:45
#include <iostream>
#include <cstdint>
inline int64_t secToNano(double sec)
{
constexpr int64_t e9 = 1e9;
const int64_t seconds = sec; // Truncate decimals
const int64_t nanoseconds = (sec - seconds) * e9;