Commit 538da9d6 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

ts/stuploxx [FIX]: properly handle negative time offset

parent 718f5f71
......@@ -43,11 +43,7 @@ namespace stuplo {
pgplot::Trange PanelTime::frange() const
{
libtime::TRelativeTime first=this->begin()-this->reference();
libtime::TRelativeTime last=this->end()-this->reference();
float ffirst=libtime::time2double(first);
float flast=libtime::time2double(last);
pgplot::Trange range(ffirst,flast);
pgplot::Trange range(this->fbegin(),this->fend());
return(range);
} // pgplot::Trange PanelTime::frange() const
......@@ -55,14 +51,18 @@ namespace stuplo {
float PanelTime::fbegin() const
{
return(float(libtime::time2double(this->begin()-this->reference())));
float diff=libtime::time2double(this->begin()-this->reference());
if (this->begin()<this->reference()) { diff *= -1.; }
return(diff);
}
/*----------------------------------------------------------------------*/
float PanelTime::fend() const
{
return(float(libtime::time2double(this->end()-this->reference())));
float diff=libtime::time2double(this->end()-this->reference());
if (this->end()<this->reference()) { diff *= -1.; }
return(diff);
}
/*----------------------------------------------------------------------*/
......@@ -73,19 +73,19 @@ namespace stuplo {
libtime::TAbsoluteTime aend;
if (range.min<0)
{
abegin=Mreferencetime-libtime::double2time(-range.min);
abegin=this->reference()-libtime::double2time(-range.min);
}
else
{
abegin=Mreferencetime+libtime::double2time(range.min);
abegin=this->reference()+libtime::double2time(range.min);
}
if (range.max<0)
{
aend=Mreferencetime-libtime::double2time(-range.max);
aend=this->reference()-libtime::double2time(-range.max);
}
else
{
aend=Mreferencetime+libtime::double2time(range.max);
aend=this->reference()+libtime::double2time(range.max);
}
this->setrange(libtime::TRange(abegin, aend));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment