Skip to content

Commit

Permalink
timestamp fault tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangibbons committed Aug 16, 2015
1 parent 2af6e5c commit 7b475b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions demo/swim.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

$units = 'm';
$pool_length = $pFFA->data_mesgs['session']['pool_length'];
$total_distance = number_format($pFFA->data_mesgs['record']['distance']);
$total_distance = number_format(max($pFFA->data_mesgs['record']['distance']));
if($pFFA->enum_data('display_measure', $pFFA->data_mesgs['session']['pool_length_unit']) == 'statute') {
$pool_length = round($pFFA->data_mesgs['session']['pool_length'] * 1.0936133);
$total_distance = number_format($pFFA->data_mesgs['record']['distance'] * 1.0936133);
$total_distance = number_format(max($pFFA->data_mesgs['record']['distance']) * 1.0936133);
$units = 'yd';
}
?>
Expand Down
13 changes: 10 additions & 3 deletions php-FIT-File-Analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,16 @@ private function read_data_records() {
}

// Process the temporary array and load values into the public data messages array
if(isset($tmp_record_array['timestamp'])) {
$timestamp = $tmp_record_array['timestamp'];
unset($tmp_record_array['timestamp']);
if(!empty($tmp_record_array)) {
$timestamp = isset($this->data_mesgs['record']['timestamp']) ? max($this->data_mesgs['record']['timestamp']) + 1 : 0;

if(isset($tmp_record_array['timestamp'])) {
if($tmp_record_array['timestamp'] > 0) {
$timestamp = $tmp_record_array['timestamp'];
}
unset($tmp_record_array['timestamp']);
}

$this->data_mesgs['record']['timestamp'][] = $timestamp;

foreach($tmp_record_array as $key => $value) {
Expand Down

0 comments on commit 7b475b6

Please sign in to comment.