Skip to content

Commit

Permalink
fix units::serialize (#36546)
Browse files Browse the repository at this point in the history
  • Loading branch information
KorGgenT authored and kevingranade committed Dec 30, 2019
1 parent b9a503d commit 63f1be8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ template<>
void volume::serialize( JsonOut &jsout ) const
{
if( value_ % 1000 == 0 ) {
jsout.write( string_format( "%d L", value_ ) );
jsout.write( string_format( "%d L", value_ / 1000 ) );
} else {
jsout.write( string_format( "%d ml", value_ ) );
}
Expand All @@ -17,9 +17,9 @@ template<>
void mass::serialize( JsonOut &jsout ) const
{
if( value_ % 1000000 == 0 ) {
jsout.write( string_format( "%d kg", value_ ) );
jsout.write( string_format( "%d kg", value_ / 1000000 ) );
} else if( value_ % 1000 == 0 ) {
jsout.write( string_format( "%d g", value_ ) );
jsout.write( string_format( "%d g", value_ / 1000 ) );
} else {
jsout.write( string_format( "%d mg", value_ ) );
}
Expand Down

0 comments on commit 63f1be8

Please sign in to comment.