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

Unified Diff: scripts/slave/recipe_modules/time/api.py

Issue 1241323004: Cross-repo recipe package system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Roll to latest recipes-py Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/slave/recipe_modules/time/__init__.py ('k') | scripts/slave/recipe_modules/time/example.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_modules/time/api.py
diff --git a/scripts/slave/recipe_modules/time/api.py b/scripts/slave/recipe_modules/time/api.py
deleted file mode 100644
index 854eb09db8e1c71a9763b7f4974dc250204f8830..0000000000000000000000000000000000000000
--- a/scripts/slave/recipe_modules/time/api.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-from recipe_engine import recipe_api
-
-import datetime
-import time
-
-class TimeApi(recipe_api.RecipeApi):
- def __init__(self, **kwargs):
- super(TimeApi, self).__init__(**kwargs)
- self._fake_time = None
- self._fake_step = None
- if self._test_data.enabled:
- self._fake_time = self._test_data.get('seed', 1337000000.0)
- self._fake_step = self._test_data.get('step', 1.5)
-
- def time(self):
- """Return current timestamp as a float number of seconds since epoch."""
- if self._test_data.enabled:
- self._fake_time += self._fake_step
- return self._fake_time
- else: # pragma: no cover
- return time.time()
-
- def utcnow(self):
- """Return current UTC time as a datetime.datetime."""
- if self._test_data.enabled:
- self._fake_time += self._fake_step
- return datetime.datetime.utcfromtimestamp(self._fake_time)
- else: # pragma: no cover
- return datetime.datetime.utcnow()
« no previous file with comments | « scripts/slave/recipe_modules/time/__init__.py ('k') | scripts/slave/recipe_modules/time/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698