Skip to content

Commit

Permalink
Fix pretty_print_time_interval for MySQL. Fix galaxyproject#1619.
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Feb 18, 2016
1 parent 476734d commit ef93629
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/galaxy/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@ def pretty_print_time_interval( time=False, precise=False ):
elif isinstance( time, datetime ):
diff = now - time
elif isinstance( time, basestring ):
time = datetime.strptime( time, "%Y-%m-%dT%H:%M:%S.%f" )
try:
time = datetime.strptime( time, "%Y-%m-%dT%H:%M:%S.%f" )
except ValueError:
# MySQL may not support microseconds precision
time = datetime.strptime( time, "%Y-%m-%dT%H:%M:%S" )
diff = now - time
else:
diff = now - now
Expand Down

0 comments on commit ef93629

Please sign in to comment.