Skip to content

Commit

Permalink
Merge pull request #12 from poundbangbash/big-sur-temp-workaround
Browse files Browse the repository at this point in the history
Workaround sets ManufactureDate to 'null'
  • Loading branch information
bochoven authored Mar 27, 2021
2 parents 54b5fb1 + d43dda6 commit f6169fa
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions power_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,17 @@ private function _adjust_battery_data()

$ManufactureDate = $this->manufacture_date;

$mfgday = $this->manufacture_date & 31;
$mfgmonth = ($this->manufacture_date >> 5) & 15;
$mfgyear = (($this->manufacture_date >> 9) & 127) + 1980;
if (is_numeric($this->manufacture_date)) {
$mfgday = $this->manufacture_date & 31;
$mfgmonth = ($this->manufacture_date >> 5) & 15;
$mfgyear = (($this->manufacture_date >> 9) & 127) + 1980;

$this->manufacture_date = sprintf("%d-%02d-%02d", $mfgyear, $mfgmonth, $mfgday);
$this->manufacture_date = sprintf("%d-%02d-%02d", $mfgyear, $mfgmonth, $mfgday);
} else {
// Hardcode the date to be 'null' for the time being until
// data from BigSur can be evaluated correctly.
$this->manufacture_date = null;
}
}

// Timestamp added by the server
Expand Down

0 comments on commit f6169fa

Please sign in to comment.