Time returns the time represented by this XID, accurate to one second.
()
| 93 | |
| 94 | // Time returns the time represented by this XID, accurate to one second. |
| 95 | func (xid XID) Time() time.Time { |
| 96 | parts := strings.Split(xid.String(), "-") |
| 97 | tsec, _ := strconv.ParseInt(parts[0], 10, 64) |
| 98 | |
| 99 | return time.Unix(tsec, 0) |
| 100 | } |
| 101 | |
| 102 | // Seq returns the sequence number represented by this XID. To get the next and previous |
| 103 | // valid XIDs for range pagination, see Next() and Prev(). |