public static bool ToTimeSpan( [NotNull] this string str, out TimeSpan result ) {
if( str == null ) throw new ArgumentNullException( "str" );
if( str.Length == 0 ) {
result = TimeSpan.Zero;
return true;
}
long ticks;
if( Int64.TryParse( str, out ticks ) ) {
result = new TimeSpan( ticks * TimeSpan.TicksPerSecond );
return true;
} else {
result = TimeSpan.Zero;
return false;
}
}