File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
storage/inchi/src/main/java/org/openscience/cdk/inchi Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 2727import net .sf .jniinchi .JniInchiException ;
2828import net .sf .jniinchi .JniInchiInput ;
2929
30+ import java .text .DecimalFormat ;
3031import java .util .List ;
3132import java .util .StringTokenizer ;
3233
@@ -91,7 +92,14 @@ private static String checkOptions(final String ops) throws JniInchiException {
9192 sbOptions .append (" " );
9293 }
9394 } else if (isTimeoutOptions (op )) {
94- sbOptions .append (FLAG_CHAR ).append (op );
95+ if (op .contains ("." ) || op .contains ("," )) { // only reformat if we actually have a decimal
96+ // because the JNI-InChI library is expecting an platform number, format it as such
97+ Double time = Double .parseDouble (op .substring (1 ));
98+ DecimalFormat format = new DecimalFormat ("#.##" );
99+ sbOptions .append (FLAG_CHAR ).append ('W' ).append (format .format (time ));
100+ } else {
101+ sbOptions .append (FLAG_CHAR ).append (op );
102+ }
95103 hasUserSpecifiedTimeout = true ;
96104 if (tok .hasMoreTokens ()) {
97105 sbOptions .append (" " );
You can’t perform that action at this time.
0 commit comments