in src/main/java/com/epam/parso/date/SasTemporalFormatter.java [103:135]
public Object formatSasTime(Double sasSeconds, OutputDateType dateFormatType,
String sasFormatName, int width, int precision) {
if (dateFormatType == SAS_VALUE) {
return sasSeconds;
} else if (sasSeconds == null || Double.isNaN(sasSeconds)) {
if (dateFormatType == SAS_FORMAT_EXPERIMENTAL || dateFormatType == SAS_FORMAT_TRIM_EXPERIMENTAL) {
return ".";
} else {
return null;
}
}
switch (dateFormatType) {
case SAS_FORMAT_EXPERIMENTAL:
case SAS_FORMAT_TRIM_EXPERIMENTAL:
boolean trim = dateFormatType == SAS_FORMAT_TRIM_EXPERIMENTAL;
return timeFormatFunctions.computeIfAbsent(sasFormatName + width + "." + precision,
k -> SasTimeFormat.valueOf(sasFormatName).getFormatFunction(width, precision, trim)
).apply(sasSeconds);
case JAVA_DATE_LEGACY:
case JAVA_TEMPORAL:
default:
// These lines below for compatibility with existing Parso result.
// Number of seconds in Parso is represented in some cases as long
// or as double using the SasFileParser.convertByteArrayToNumber function.
long longSeconds = Math.round(sasSeconds);
if (Math.abs(sasSeconds - longSeconds) > 0) {
return sasSeconds;
} else {
return longSeconds;
}
}
}