| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package clock | 5 package clock |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "time" | 8 "time" |
| 9 | 9 |
| 10 "golang.org/x/net/context" | 10 "golang.org/x/net/context" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return | 43 return |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Now calls Clock.Now on the Clock instance stored in the supplied Context. | 46 // Now calls Clock.Now on the Clock instance stored in the supplied Context. |
| 47 func Now(ctx context.Context) time.Time { | 47 func Now(ctx context.Context) time.Time { |
| 48 return Get(ctx).Now() | 48 return Get(ctx).Now() |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Sleep calls Clock.Sleep on the Clock instance stored in the supplied Context. | 51 // Sleep calls Clock.Sleep on the Clock instance stored in the supplied Context. |
| 52 func Sleep(ctx context.Context, d time.Duration) { | 52 func Sleep(ctx context.Context, d time.Duration) { |
| 53 » Get(ctx).Sleep(d) | 53 » Get(ctx).Sleep(ctx, d) |
| 54 } | 54 } |
| 55 | 55 |
| 56 // NewTimer calls Clock.NewTimer on the Clock instance stored in the supplied | 56 // NewTimer calls Clock.NewTimer on the Clock instance stored in the supplied |
| 57 // Context. | 57 // Context. |
| 58 func NewTimer(ctx context.Context) Timer { | 58 func NewTimer(ctx context.Context) Timer { |
| 59 » return Get(ctx).NewTimer() | 59 » return Get(ctx).NewTimer(ctx) |
| 60 } | 60 } |
| 61 | 61 |
| 62 // After calls Clock.After on the Clock instance stored in the supplied Context. | 62 // After calls Clock.After on the Clock instance stored in the supplied Context. |
| 63 func After(ctx context.Context, d time.Duration) <-chan time.Time { | 63 func After(ctx context.Context, d time.Duration) <-chan AfterResult { |
| 64 » return Get(ctx).After(d) | 64 » return Get(ctx).After(ctx, d) |
| 65 } | 65 } |
| OLD | NEW |