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

Side by Side Diff: tools/win/subtract_time.py

Issue 2820843002: Add timeit.bat to tools\win (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | tools/win/timeit.bat » ('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 (c) 2017 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 """
6 This script converts to %time% compatible strings passed to it into seconds,
7 subtracts them, and prints the difference. That's it. It's used by timeit.bat.
8 """
9
10 import re
11 import sys
12
13 def ParseTime(time_string):
14 # Time looks like 15:19:30.32
15 match = re.match("(.*):(.*):(.*)\.(.*)", time_string)
16 hours, minutes, seconds, fraction = map(int, match.groups())
17 return hours * 3600 + minutes * 60 + seconds + fraction * .01
18
19 print "%1.2f seconds elapsed time" % (ParseTime(sys.argv[1]) -
20 ParseTime(sys.argv[2]))
OLDNEW
« no previous file with comments | « no previous file | tools/win/timeit.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698