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

Side by Side Diff: appengine/findit/common/time_util.py

Issue 2043973002: [Findit] Fracas crash triage dashboard (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Surpass pylint errors. Created 4 years, 5 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
« no previous file with comments | « appengine/findit/common/test/time_util_test.py ('k') | appengine/findit/crash/fracas.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 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 from datetime import datetime
6 from datetime import time
7 from datetime import timedelta
8
9
10 def RemoveMicrosecondsFromDelta(delta):
11 """Returns a timedelta object without microseconds based on delta."""
12 return delta - timedelta(microseconds=delta.microseconds)
13
14
15 def FormatTimedelta(delta):
16 if not delta:
17 return None
18 hours, remainder = divmod(delta.seconds, 3600)
19 minutes, seconds = divmod(remainder, 60)
20 return '%02d:%02d:%02d' % (hours, minutes, seconds)
21
22
23 def FormatDatetime(date):
24 if not date:
25 return None
26 else:
27 return date.strftime('%Y-%m-%d %H:%M:%S UTC')
OLDNEW
« no previous file with comments | « appengine/findit/common/test/time_util_test.py ('k') | appengine/findit/crash/fracas.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698