my_activity.py: Parse rietveld dates without milliseconds.

Sometimes rietveld returns a datetime without the milliseconds part,
presumably when it is 0. This patch fixes the parsing of those cases.

BUG=chromium:323615
TEST=Ran "my_activity.py --week_of 11/18/13 --user jsbell" which returns "2013-11-18 20:42:30" for a bug.

Review URL: https://codereview.chromium.org/204013009

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@258189 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/my_activity.py b/my_activity.py
index 33694eb..48aeaea 100755
--- a/my_activity.py
+++ b/my_activity.py
@@ -191,7 +191,12 @@
 
 
 def datetime_from_rietveld(date_string):
-  return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f')
+  try:
+    return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S.%f')
+  except ValueError:
+    # Sometimes rietveld returns a value without the milliseconds part, so we
+    # attempt to parse those cases as well.
+    return datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S')
 
 
 def datetime_from_google_code(date_string):