public static double timeStringToExactSeconds(String input){
  if (input.equals("oo")) {
    return Double.POSITIVE_INFINITY;
  }
  if (input.equals("-oo")) {
    return Double.NEGATIVE_INFINITY;
  }
  double time=0;
  String currentUnit="";
  String current="";
  for (int i=0; i < input.length(); i++) {
    char c=input.charAt(i);
    if (Character.isDigit(c) && !currentUnit.equals("")) {
      time+=parseTime(Numbers.parseDouble(current),currentUnit);
      current="";
      currentUnit="";
    }
    if (Character.isDigit(c) || c == '.') {
      current+=c + "";
    }
 else     if (c != '-') {
      currentUnit+=c + "";
    }
  }
  time+=parseTime(Numbers.parseDouble(current),currentUnit);
  if (input.startsWith("-")) {
    time*=-1;
  }
  return time;
}

public static double timeStringToExactSeconds ( String input ) { if ( input . equals ( "oo" ) ) { return Double . POSITIVE_INFINITY ; } if ( input . equals ( "-oo" ) ) { return Double . NEGATIVE_INFINITY ; } double time = 0 ; String currentUnit = "" ; String current = "" ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { char c = input . charAt ( i ) ; if ( Character . isDigit ( c ) && ! currentUnit . equals ( "" ) ) { time += parseTime ( Numbers . parseDouble ( current ) , currentUnit ) ; current = "" ; currentUnit = "" ; } if ( Character . isDigit ( c ) || c == '.' ) { current += c + "" ; } else if ( c != '-' ) { currentUnit += c + "" ; } } time += parseTime ( Numbers . parseDouble ( current ) , currentUnit ) ; if ( input . startsWith ( "-" ) ) { time *= - 1 ; } return time ; }
converts a time - string , to a time , in seconds .
