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 # that can be found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 """Provides functions for parsing and outputting Zulu time.""" | 6 """Provides functions for parsing and outputting Zulu time.""" |
7 | 7 |
8 import datetime | 8 import datetime |
9 import pytz | 9 import pytz |
10 | 10 |
11 from infra_libs.time_functions import timestamp | 11 from infra_libs.time_functions import timestamp |
12 | 12 |
13 | 13 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 print dt | 47 print dt |
48 | 48 |
49 # Convert datetime into UTC. | 49 # Convert datetime into UTC. |
50 isodate = dt.astimezone(pytz.UTC).isoformat().split('+')[0] | 50 isodate = dt.astimezone(pytz.UTC).isoformat().split('+')[0] |
51 | 51 |
52 # Add fractional seconds if not present. | 52 # Add fractional seconds if not present. |
53 if '.' not in isodate: | 53 if '.' not in isodate: |
54 isodate += '.0' | 54 isodate += '.0' |
55 | 55 |
56 return isodate + 'Z' | 56 return isodate + 'Z' |
OLD | NEW |