mirror of
https://github.com/nasa/trick.git
synced 2025-01-29 15:43:57 +00:00
I'm not sure why we're padding floats and doubles in vs_format_ascii. It results in sending a bunch of useless spaces which hurts efficiency. Values are already tab-delimited, so fixed-width fields are unnecessary. We're not padding anything else, so don't pad these!
This commit is contained in:
parent
2f5c219f98
commit
aedd6b2be3
@ -137,23 +137,23 @@ int vs_format_ascii(Trick::VariableReference * var, char *value) {
|
||||
break;
|
||||
|
||||
case TRICK_FLOAT:
|
||||
sprintf(value, "%s%-14.8g", value, var->conversion_factor->eval(*(float *)buf_ptr));
|
||||
sprintf(value, "%s%.8g", value, var->conversion_factor->eval(*(float *)buf_ptr));
|
||||
break;
|
||||
|
||||
case TRICK_DOUBLE:
|
||||
sprintf(value, "%s%-21.16g", value, var->conversion_factor->eval(*(double *)buf_ptr));
|
||||
sprintf(value, "%s%.16g", value, var->conversion_factor->eval(*(double *)buf_ptr));
|
||||
break;
|
||||
|
||||
case TRICK_LONG_LONG:
|
||||
// This is a work-round for when terminate_time is not defined and is requested through variable server.
|
||||
// When sim terminate time is not defined, the related variable is the max of the type.
|
||||
// The unit conversion calculation will throw floating point exception.
|
||||
// For trick_sys.sched.terminate_time, there is no need to perform such conversion.
|
||||
if (!var_name.compare("trick_sys.sched.terminate_time")) {
|
||||
sprintf(value, "%s%lld", value, *(long long *)buf_ptr);
|
||||
} else {
|
||||
sprintf(value, "%s%lld", value, (long long)var->conversion_factor->eval(*(long long *)buf_ptr));
|
||||
}
|
||||
// This is a work-round for when terminate_time is not defined and is requested through variable server.
|
||||
// When sim terminate time is not defined, the related variable is the max of the type.
|
||||
// The unit conversion calculation will throw floating point exception.
|
||||
// For trick_sys.sched.terminate_time, there is no need to perform such conversion.
|
||||
if (!var_name.compare("trick_sys.sched.terminate_time")) {
|
||||
sprintf(value, "%s%lld", value, *(long long *)buf_ptr);
|
||||
} else {
|
||||
sprintf(value, "%s%lld", value, (long long)var->conversion_factor->eval(*(long long *)buf_ptr));
|
||||
}
|
||||
break;
|
||||
|
||||
case TRICK_UNSIGNED_LONG_LONG:
|
||||
@ -163,7 +163,7 @@ int vs_format_ascii(Trick::VariableReference * var, char *value) {
|
||||
case TRICK_NUMBER_OF_TYPES:
|
||||
sprintf(value, "BAD_REF" );
|
||||
break;
|
||||
|
||||
|
||||
default:{
|
||||
return (-1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user