['all'], // 'units' => ['metric'] ]; $pFFA = new adriangibbons\phpFITFileAnalysis(__DIR__ . $file, $options); // Google Time Zone API $date = new DateTime('now', new DateTimeZone('UTC')); $date_s = $pFFA->data_mesgs['session']['start_time']; $url_tz = "https://maps.googleapis.com/maps/api/timezone/json?location=".reset($pFFA->data_mesgs['record']['position_lat']).','.reset($pFFA->data_mesgs['record']['position_long'])."×tamp=".$date_s."&key=AIzaSyDlPWKTvmHsZ-X6PGsBPAvo0nm1-WdwuYE"; $result = file_get_contents("$url_tz"); $json_tz = json_decode($result); if ($json_tz->status == "OK") { $date_s = $date_s + $json_tz->rawOffset + $json_tz->dstOffset; } $date->setTimestamp($date_s); $crank_length = 0.175; $ftp = 329; $selected_cadence = 90; $json = $pFFA->getJSON($crank_length, $ftp, ['all'], $selected_cadence); } catch (Exception $e) { echo 'caught exception: '.$e->getMessage(); die(); } ?>
This is a demonstration of the phpFITFileAnalysis class available on GitHub