title: From UnixNano() to Time{}
body: <p>I want to convert a <a href="https://golang.org/pkg/time/#Time.UnixNano" rel="noreferrer">UnixNano() int64</a> time stamp back to a <a href="https://golang.org/pkg/time/#Time" rel="noreferrer">time.Time{}</a>.</p>
  
  <p>Taking a step back, here is the larger issue.</p>
  
  <p>We have a database with timestamps, we use these timestamps to pull entries. In nanotime there should never be duplicate timestamps. The database is an embedded SQLite3 database (via the "<a href="https://github.com/mattn/go-sqlite3" rel="noreferrer">github.com/mattn/go-sqlite3</a>" driver) with the stamp held in an INTEGER column. We do some sorting and filtering with the number value, in the form of clauses on selects and within a few views.</p>
  
  <p>Thus when we bind our integers to our prepared statements like: </p>
  
  <pre><code>INSERT INTO "event" ("timestamp", "command", "data") VALUES (?, ?, ?)
  </code></pre>
  
  <p>we bind time.Now().UnixNano().</p>
  
  <p>However when I try to convert the item to a data structure, I find I cannot accurately take a UnixNano time and reconstitute it back to a time.Time{} structure.</p>
  
  <p>They never match.</p>
  
  <p>How should I do this?</p>