Implementing a custom conversion logic is as easy as defining a CTools plugin in the code of your module. The owner of plugin is units module, the plugin name is converters. You can find an example of such plugin implementation in the plugins folder of units module. The parameters of converters plugin should be:
title
Required. The human readable name of your conversion logic.
description
A brief description of your conversion logic. Try to explain how the conversion happens or, maybe, to what measures it logically applies.
convert callback
Required. This is the name of the function that will be responsible for executing actual conversion between units. This function will receive the following input arguments:
  1. $value: (float) Value in $from units that should be converted into $to units
  2. $from: (object) Units entity in which $value is represented
  3. $to: (object) Units entity into which $value should be converted
Your function should execute units conversion based on these input arguments, and it should output float - $value converted into $to units