How to calculate field values in Views Calc?
Edit: Sorry, I overread "Views Calc" before I wrote my answer. But maybe it helps you nevertheless.



Views maybe isn't the right place to add your custom code to. You might consider writing a very small custom module. Let Views then maybe display full nodes. And in your custom module you might hook into hook_node_view(), grab your node's fields, do the calculation and finally add the result as a new field to the the node's content, which then will get rendered automatically:

function MY_MODULE_node_view($node) {
    dpm($node); // start with that

    $time = $node-&gt;field_time[LANGUAGE_NONE][0]['value'];
    $distance = $node-&gt;field_distance[LANGUAGE_NONE][0]['value'];

    // do your calculations
    // ...

    $speed = $result;

    $node-&gt;content['speed'] = array(
        '#prefix' =&gt; '&lt;div id="speed"&gt;',
        '#markup' =&gt; $speed,
        '#suffix' =&gt; '&lt;/div&gt;'
    );
}


When developing your custom module you might find the Devel module quite helpful. After activating it you can easily check out what's inside a variable and then double click the displayed results for a deeper insight. So you might start by calling dpm($node) right inside hook_node_view().