Skip to content

Commit

Permalink
fix timestamp handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 committed Mar 26, 2021
1 parent 5f4eb2a commit 11b27e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 12 additions & 5 deletions cli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1546,9 +1546,10 @@ var clientListDeals = &cli.Command{
Name: "hide-failed",
Usage: "hide failed/failing deals",
},
&cli.Int64Flag{
&cli.TimestampFlag{
Name: "creation-time-offset",
Usage: "unix epoch seconds specifying the minimum creation time offset of the deals to include in the deal list page",
Layout: time.RFC3339,
Usage: "minimum creation time offset of the deals to include in the deal list page",
DefaultText: "no-op",
},
&cli.IntFlag{
Expand Down Expand Up @@ -1579,14 +1580,19 @@ var clientListDeals = &cli.Command{
color := cctx.Bool("color")
watch := cctx.Bool("watch")

ctOffset := cctx.Int64("creation-time-offset")
ctOffset := cctx.Timestamp("creation-time-offset")
nDeals := cctx.Int("limit")
minStart := cctx.Int64("min-start-epoch")
maxEnd := cctx.Int64("max-end-epoch")
hideFailed := cctx.Bool("hide-failed")

var timeOffset time.Time
if ctOffset != nil {
timeOffset = *ctOffset
}

filter := storagemarket.ListDealsPageParams{
CreationTimePageOffset: time.Unix(ctOffset, 0),
CreationTimePageOffset: timeOffset,
DealsPerPage: nDeals,
MinStartEpoch: abi.ChainEpoch(minStart),
MaxEndEpoch: abi.ChainEpoch(maxEnd),
Expand Down Expand Up @@ -1702,8 +1708,9 @@ func outputStorageDeals(ctx context.Context, out io.Writer, full lapi.FullNode,
// transferPct = fmt.Sprintf("%d%%", pct)
//}
}

fmt.Fprintf(w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%d\t%s\t%s\t%v\t%s\n",
d.LocalDeal.CreationTime.Format(time.Stamp),
d.LocalDeal.CreationTime.Format(time.RFC3339),
d.LocalDeal.ProposalCid,
d.LocalDeal.DealID,
d.LocalDeal.Provider,
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go
github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c=
github.com/filecoin-project/go-fil-markets v1.0.8-0.20210325080341-82f614c26d93 h1:narSwEt79rz2G3KCDwOirr1sGPQ1wA1gLKxX1I/qW0w=
github.com/filecoin-project/go-fil-markets v1.0.8-0.20210325080341-82f614c26d93/go.mod h1:p5BIKl6sEoeOCKFa3/nfy66Q95rifEkJyGQgaNjPsno=
github.com/filecoin-project/go-fil-markets v1.2.3 h1:JDbGKQf60tB00TFKG/nofSyHyIEbqowZqoLOfda7yTs=
github.com/filecoin-project/go-fil-markets v1.2.3/go.mod h1:p5BIKl6sEoeOCKFa3/nfy66Q95rifEkJyGQgaNjPsno=
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
Expand Down

0 comments on commit 11b27e3

Please sign in to comment.