| OLD | NEW |
| (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') |
| OLD | NEW |