9
function __construct(&$reader, $opts = false) {
10
$this->start_time = strtotime("January 16 2008") ;
11
// $this->rate = 10000;
13
$this->reader = &$reader;
16
function ImportTime($dt) {
17
// $ret = round(dsMathPreciseSubstract($dt->format("U.u"), $this->start_time)*$this->rate);
18
// echo $dt->format("U.u") . "," . $ret . "," . $this->ExportTime($ret)->format("U.u") . ".\n";
20
return round(dsMathPreciseSubstract($dt->format("U.u"), $this->start_time)*$this->rate);
23
function ExportTime($db_time) {
24
$unix_time = dsMathPreciseAdd($this->start_time, $db_time/$this->rate);
25
$itime = (int)floor($unix_time);
27
if ($itime==$unix_time) {
28
return new DateTime("@$itime", $this->reader->gmt_timezone);
30
$subsec = strchr(sprintf("%F", $unix_time), '.');
31
return new DateTime(strftime("%Y/%m/%d %H:%M:%S", $itime) . $subsec, $this->reader->gmt_timezone);
b'\\ No newline at end of file'