diff --git a/library/cpp/src/core/config/value_with_unit.cc b/library/cpp/src/core/config/value_with_unit.cc index d8ab30558..ef84b3425 100644 --- a/library/cpp/src/core/config/value_with_unit.cc +++ b/library/cpp/src/core/config/value_with_unit.cc @@ -7,23 +7,33 @@ namespace wavemap::param { // clang-format off static const std::map> UnitToSi{ - {"meters", {1e0f, SiUnit::kMeters}}, - {"m", {1e0f, SiUnit::kMeters}}, - {"decimeters", {1e-1f, SiUnit::kMeters}}, - {"dm", {1e-1f, SiUnit::kMeters}}, - {"centimeters", {1e-2f, SiUnit::kMeters}}, - {"cm", {1e-2f, SiUnit::kMeters}}, - {"millimeters", {1e-3f, SiUnit::kMeters}}, - {"mm", {1e-3f, SiUnit::kMeters}}, - {"radians", {1.f, SiUnit::kRadians}}, - {"rad", {1.f, SiUnit::kRadians}}, - {"degrees", {kPi / 180.f, SiUnit::kRadians}}, - {"deg", {kPi / 180.f, SiUnit::kRadians}}, - {"pixels", {1.f, SiUnit::kPixels}}, - {"px", {1.f, SiUnit::kPixels}}, - {"seconds", {1.f, SiUnit::kSeconds}}, - {"sec", {1.f, SiUnit::kSeconds}}, - {"s", {1.f, SiUnit::kSeconds}}, + {"kilometers", {1e3f, SiUnit::kMeters}}, + {"km", {1e3f, SiUnit::kMeters}}, + {"meters", {1e0f, SiUnit::kMeters}}, + {"m", {1e0f, SiUnit::kMeters}}, + {"decimeters", {1e-1f, SiUnit::kMeters}}, + {"dm", {1e-1f, SiUnit::kMeters}}, + {"centimeters", {1e-2f, SiUnit::kMeters}}, + {"cm", {1e-2f, SiUnit::kMeters}}, + {"millimeters", {1e-3f, SiUnit::kMeters}}, + {"mm", {1e-3f, SiUnit::kMeters}}, + {"radians", {1.f, SiUnit::kRadians}}, + {"rad", {1.f, SiUnit::kRadians}}, + {"degrees", {kPi / 180.f, SiUnit::kRadians}}, + {"deg", {kPi / 180.f, SiUnit::kRadians}}, + {"pixels", {1.f, SiUnit::kPixels}}, + {"px", {1.f, SiUnit::kPixels}}, + {"hours", {3600.f, SiUnit::kSeconds}}, + {"h", {3600.f, SiUnit::kSeconds}}, + {"minutes", {60.f, SiUnit::kSeconds}}, + {"seconds", {1.f, SiUnit::kSeconds}}, + {"sec", {1.f, SiUnit::kSeconds}}, + {"s", {1.f, SiUnit::kSeconds}}, + {"milliseconds", {1e-3f, SiUnit::kSeconds}}, + {"ms", {1e-3f, SiUnit::kSeconds}}, + {"microseconds", {1e-6f, SiUnit::kSeconds}}, + {"nanoseconds", {1e-9f, SiUnit::kSeconds}}, + {"ns", {1e-9f, SiUnit::kSeconds}}, }; // clang-format on diff --git a/tooling/schemas/wavemap/value_with_unit/convertible_to_meters.json b/tooling/schemas/wavemap/value_with_unit/convertible_to_meters.json index 6328f534c..4f14495ef 100644 --- a/tooling/schemas/wavemap/value_with_unit/convertible_to_meters.json +++ b/tooling/schemas/wavemap/value_with_unit/convertible_to_meters.json @@ -5,6 +5,12 @@ "minProperties": 1, "maxProperties": 1, "properties": { + "kilometers": { + "type": "number" + }, + "km": { + "type": "number" + }, "meters": { "type": "number" }, diff --git a/tooling/schemas/wavemap/value_with_unit/convertible_to_seconds.json b/tooling/schemas/wavemap/value_with_unit/convertible_to_seconds.json index 69bb9bb3f..a4cfc291b 100644 --- a/tooling/schemas/wavemap/value_with_unit/convertible_to_seconds.json +++ b/tooling/schemas/wavemap/value_with_unit/convertible_to_seconds.json @@ -5,6 +5,15 @@ "minProperties": 1, "maxProperties": 1, "properties": { + "hours": { + "type": "number" + }, + "h": { + "type": "number" + }, + "minutes": { + "type": "number" + }, "seconds": { "type": "number" }, @@ -13,6 +22,21 @@ }, "s": { "type": "number" + }, + "milliseconds": { + "type": "number" + }, + "ms": { + "type": "number" + }, + "microseconds": { + "type": "number" + }, + "nanoseconds": { + "type": "number" + }, + "ns": { + "type": "number" } } }