Move timeutils functions to the only places where they are used.

- Move time json marshaling to the jsonlog package: this is a docker
  internal hack that we should not promote as a library.
- Move Timestamp encoding/decoding functions to the API types: This is
  only used there. It could be a standalone library but I don't this
it's worth having a separated repo for this. It could introduce more
complexity than it solves.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera
2015-12-15 14:49:41 -05:00
parent 2180dd6cf0
commit 27220ecc6b
15 changed files with 44 additions and 50 deletions

View File

@@ -13,11 +13,11 @@ import (
"github.com/docker/distribution/registry/api/errcode"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
timetypes "github.com/docker/docker/api/types/time"
"github.com/docker/docker/daemon"
derr "github.com/docker/docker/errors"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/timeutils"
"github.com/docker/docker/runconfig"
"github.com/docker/docker/utils"
"golang.org/x/net/context"
@@ -101,7 +101,7 @@ func (s *containerRouter) getContainersLogs(ctx context.Context, w http.Response
var since time.Time
if r.Form.Get("since") != "" {
s, n, err := timeutils.ParseTimestamps(r.Form.Get("since"), 0)
s, n, err := timetypes.ParseTimestamps(r.Form.Get("since"), 0)
if err != nil {
return err
}

View File

@@ -9,10 +9,10 @@ import (
"github.com/docker/docker/api"
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
timetypes "github.com/docker/docker/api/types/time"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/parsers/filters"
"github.com/docker/docker/pkg/timeutils"
"golang.org/x/net/context"
)
@@ -46,11 +46,11 @@ func (s *systemRouter) getEvents(ctx context.Context, w http.ResponseWriter, r *
if err := httputils.ParseForm(r); err != nil {
return err
}
since, sinceNano, err := timeutils.ParseTimestamps(r.Form.Get("since"), -1)
since, sinceNano, err := timetypes.ParseTimestamps(r.Form.Get("since"), -1)
if err != nil {
return err
}
until, untilNano, err := timeutils.ParseTimestamps(r.Form.Get("until"), -1)
until, untilNano, err := timetypes.ParseTimestamps(r.Form.Get("until"), -1)
if err != nil {
return err
}