Commit 5519b653 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

handle sign of delay

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/branches/libdatrwxx.su
SVN Revision: 3478
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent f40b39f0
...@@ -120,11 +120,17 @@ namespace datrw { ...@@ -120,11 +120,17 @@ namespace datrw {
&& (this->srce().cz == Mnextheader.srce().cz)), && (this->srce().cz == Mnextheader.srce().cz)),
"ERROR (isustream::readheader): " "ERROR (isustream::readheader): "
"current source differs from previous"); "current source differs from previous");
datrw::Exception::dont_report_on_construct();
try { try {
Mnextheader.read(Mis); Mnextheader.read(Mis);
} catch (datrw::su::SUReadException) } catch (datrw::su::SUReadException)
{ {
this->setlast(); this->setlast();
} catch (datrw::Exception E)
{
datrw::Exception::report_on_construct();
E.report();
throw(E);
} }
DATRW_debug(Mdebug, "isustream::readheader","leave function"); DATRW_debug(Mdebug, "isustream::readheader","leave function");
} // void isustream::readheader() } // void isustream::readheader()
......
...@@ -157,15 +157,38 @@ namespace datrw { ...@@ -157,15 +157,38 @@ namespace datrw {
//! return date of first sample //! return date of first sample
libtime::TAbsoluteTime SUheader::dateoffirstsample() const libtime::TAbsoluteTime SUheader::dateoffirstsample() const
{ {
return(this->dateofshot()+this->delay()); libtime::TAbsoluteTime date=this->dateofshot();
if (this->delayispositive())
{
date += this->delay();
} else {
date -= this->delay();
}
return(date);
} // libtime::TAbsoluteTime SUheader::dateoffirstsample() const } // libtime::TAbsoluteTime SUheader::dateoffirstsample() const
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
// is delay positive
bool SUheader::delayispositive() const
{
return(Mheader.delrt>=0);
} // bool SUheader::delayispositive() const
/*----------------------------------------------------------------------*/
// absolute delay value
int SUheader::absdelay() const
{
return(Mheader.delrt>=0 ? Mheader.delrt : -Mheader.delrt);
} // int SUheader::absdelay() const
/*----------------------------------------------------------------------*/
//! return recording delay //! return recording delay
libtime::TRelativeTime SUheader::delay() const libtime::TRelativeTime SUheader::delay() const
{ {
return(libtime::double2time(1.e-3*static_cast<double>(Mheader.delrt))); return(libtime::double2time(1.e-3*static_cast<double>(this->absdelay())));
} // libtime::TRelativeTime SUheader::delay() const } // libtime::TRelativeTime SUheader::delay() const
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
......
...@@ -101,6 +101,10 @@ namespace datrw { ...@@ -101,6 +101,10 @@ namespace datrw {
libtime::TAbsoluteTime dateoffirstsample() const; libtime::TAbsoluteTime dateoffirstsample() const;
//! recording delay //! recording delay
libtime::TRelativeTime delay() const; libtime::TRelativeTime delay() const;
//! is delay positive recording delay
bool delayispositive() const;
//! absolute (always positive) delay value
int absdelay() const;
//! return date of shot //! return date of shot
libtime::TAbsoluteTime dateofshot() const; libtime::TAbsoluteTime dateofshot() const;
//! return SRCE line //! return SRCE line
......
Supports Markdown
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