Logo Search packages:      
Sourcecode: pwlib version File versions

PTimeInterval PTime::operator- ( const PTime time  )  const

Calculate the difference between two times to get a time interval.

Returns:
Time intervale difference between the times.
Parameters:
time  Time to subtract from the time.

Definition at line 783 of file ptime.cxx.

References microseconds, and theTime.

{
  time_t secs = theTime - t.theTime;
  long usecs = microseconds - t.microseconds;
  if (usecs < 0) {
    usecs += 1000000;
    secs--;
  }
  else if (usecs >= 1000000) {
    usecs -= 1000000;
    secs++;
  }
  return PTimeInterval(usecs/1000, secs);
}


Generated by  Doxygen 1.6.0   Back to index