Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: go/src/infra/libs/clock/testclock/context.go

Issue 1154213012: Add context-aware "time" library wrapper. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Added coverage files. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package testclock
6
7 import (
8 "time"
9
10 "golang.org/x/net/context"
11 "infra/libs/clock"
12 )
13
14 // UseTime instantiates a TestClock and returns a Context that is configured to
15 // use that clock, as well as the instantiated clock.
16 func UseTime(ctx context.Context, now time.Time) (rctx context.Context, tc TestC lock) {
17 tc = New(now)
18 rctx = clock.Set(ctx, tc)
19 return
20 }
OLDNEW
« no previous file with comments | « go/src/infra/libs/clock/systemtimer_test.go ('k') | go/src/infra/libs/clock/testclock/testclock.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698