Remove obsolete comment and add Earliest and Latest timestamp.

The latter is to eradicate the various MaxInt64 and MinInt64 in the
codebase.
This commit is contained in:
beorn7 2015-02-11 17:34:59 +01:00
parent c70db11f1e
commit 7d560564f9
1 changed files with 10 additions and 7 deletions

View File

@ -14,18 +14,14 @@
package model package model
import ( import (
"math"
"strconv" "strconv"
native_time "time" native_time "time"
) )
// TODO(julius): Should this use milliseconds/nanoseconds instead? This is // Timestamp is the number of milliseconds since the epoch
// mostly hidden from the user of these types when using the // (1970-01-01 00:00 UTC) excluding leap seconds.
// methods below, so it will be easy to change this later
// without requiring significant user code changes.
// Timestamp is the number of seconds since the epoch (1970-01-01 00:00 UTC)
// without leap seconds.
type Timestamp int64 type Timestamp int64
const ( const (
@ -36,6 +32,13 @@ const (
second = int64(native_time.Second / MinimumTick) second = int64(native_time.Second / MinimumTick)
// The number of nanoseconds per minimum tick. // The number of nanoseconds per minimum tick.
nanosPerTick = int64(MinimumTick / native_time.Nanosecond) nanosPerTick = int64(MinimumTick / native_time.Nanosecond)
// Earliest is the earliest timestamp representable. Handy for
// initializing a high watermark.
Earliest = Timestamp(math.MinInt64)
// Latest is the latest timestamp representable. Handy for initializing
// a low watermark.
Latest = Timestamp(math.MaxInt64)
) )
// Equal reports whether two timestamps represent the same instant. // Equal reports whether two timestamps represent the same instant.